• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

8. Dynamic Forms > 8.5. Changing a Form’s Action

Changing a Form’s Action

NN 2, IE 3

Problem

You want to submit a form to a different action depending on user activity in the page.

Solution

The most common scenario is a form with two or more buttons that submit the form, but each button directs the form to a different CGI program on the server. If you use submit-type input elements, use the onclick event handlers to assign the desired CGI URL to the action property of the form:

<input type="submit" value="Send To HeadQuarters" 
onclick="this.form.action='http://main.megacorp.com/submitSpecs.asp'" />
<input type="submit" value="Send For Peer Review" 
onclick="this.form.action='http://eng.megacorp.com/reviewComm.asp'" />

Any function executing before the form submits itself can assign a URL to the form element’s action property to influence where the form goes.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint