Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple JS links with one form / submit 1

Status
Not open for further replies.

fdarkness

Programmer
Feb 17, 2006
110
CA
Due to having to use a big hammer on my code, I've run into a bit of a hiccup.

I have the following link on a page:

Code:
<form method="post" action="/timesheet/UserMain.aspx" name="timesheet_form">
	<input type="hidden" name="UserID" value="<%=Session("UserID")%>">
	<a href="javascript:document.timesheet_form.submit();">Timesheet Application</a></form>

It works perfectly and how I want it to work.

The problem is I now have to add a second link to the same page that mimics the actions of the first link. There has to be a way to put the target (listed as UserMain.aspx in the form tag) in the a href tag instead so I can have one form tag to handle both links instead of two form tags. I'm very rusty on my Javascript and I'm not finding how to do this. Any hints?
 
How about something like this:
Code:
<form method="post" name="timesheet_form">
    <input type="hidden" name="UserID" value="<%=Session("UserID")%>">
    <a href="javascript:documen.timesheet.action = '/timesheet/UserMain.aspx'; document.timesheet_form.submit();">Timesheet Application</a>
<br>

<a href="javascript:documen.timesheet.action = '/timesheet/UserWorksheet.aspx'; document.timesheet_form.submit();">Worksheet Application</a>

</form>

This method would allow you to add as many actions as you want.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top