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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making a form do something other than the action.

Status
Not open for further replies.

travmak

Programmer
Apr 26, 2002
133
US
I have a page with two forms.
<form name= &quot;1&quot; action=&quot;pageA&quot; method= &quot;post&quot;>
stuff
<input type = &quot;submit&quot; value = &quot;submit form 1&quot;>
</form>

<form name= &quot;2&quot; action=&quot;pageB&quot; method= &quot;post&quot;>
stuff
<input type = &quot;submit&quot; value = &quot;submit form 2&quot;>
</form>

My problem is I want form 2 to go to pageB with the stuff from form 1
can i make a single form with two buttons? how? or do I need to import the stuff from form 1 into form 2? how?

please help
 
This solution only works if JavaScript is enabled on the browser.
Code:
<script type=&quot;text/javascript&quot;>
  function submitForm(url)
   {
      document.forms.myForm.action=url;
      document.forms.myForm.submit();
   }
</script>
<form name=&quot;myForm&quot;>
   <!--- Put your inputs here --->
   <input type=&quot;button&quot; name=&quot;submit1&quot; onclick=&quot;submitForm('handlerpage1.cfm');&quot; />
   <input type=&quot;button&quot; name=&quot;submit2&quot; onclick=&quot;submitForm('handlerpage2.cfm');&quot; />
</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top