multiple buttons on a form

M

Matt

The ASP page has multiple buttons, and when the user clicks different
buttons, it will submit the form data to different URLs.

My first approach was to use BUTTON type, and triggers javascript function
to submit the form data. However, it didn't work properly and I changed to
use SUBMIT type.

<INPUT TYPE="BUTTON" NAME="action1" VALUE="Return to Main Search Page"
onClick="action1()">

function action1()
{ //etc...
document.myform.action = "main.asp"
document.myform.submit();
}

OR

<INPUT TYPE="SUBMIT" NAME="action1" VALUE="Return to Main Search Page"
onClick="action1()">

function action1()
{ //etc...
document.myform.action = "main.asp"
}

So which is the appropriate way? please advise. thanks!!
 
D

David Dorward

Matt said:
The ASP page has multiple buttons, and when the user clicks different
buttons, it will submit the form data to different URLs.

<input type="submit" name="foo" value="bar">
<input type="submit" name="foo" value="baz">

Then test the value of foo in your server side script. That way you don't
depend on JavaScript being on on the client.
 
R

rf

Matt wrote
The ASP page has multiple buttons, and when the user clicks different
buttons, it will submit the form data to different URLs.

Have you not been TOLD about multiposting?

Cross post if you must but do NOT multipost. I just spent several minutes
over at another newsgroup drafting a reply to your question, only to come
here (thankfully before pressing Send) to find that your question has
ALREADY BEEN ANSWERED HALF AN HOUR AGO!

Pissed me right off :-(
 
W

Webcastmaker

Cross post if you must but do NOT multipost. I just spent several minutes
over at another newsgroup drafting a reply to your question, only to come
here (thankfully before pressing Send) to find that your question has
ALREADY BEEN ANSWERED HALF AN HOUR AGO!
Pissed me right off :-(

Man, I agree with you about multiposting, but dude, take a pill, it's
only usenet.
 
R

rf

Webcastmaker said:
Man, I agree with you about multiposting, but dude, take a pill, it's
only usenet.

True. My bad. However I was still in a fume about *your* asinine arguments
in that other thread :)

Multiposting STILL pisses me off.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,414
Latest member
GayleWedel

Latest Threads

Top