form post help

  • Thread starter Thread starter Paul M
  • Start date Start date
P

Paul M

Hi
Is it possible to have two submit buttons in a form. One which posts the
form to a credit card form handler and the other which posts to an email
form handler.
Thanks
Paul M
 
No. You can have 2 buttons on the form but only one can be submit (which
posts to whatever the form action is). The other you would make as a
"button" and use JavaScript to have it submit to a different page.
 
It is possible. At least if you write your own ASP code instead of the
automagical FP "code".

One way to do what you want is to name your submit buttons the same.

<input type="submit" name="submitButton" value="Credit Card">
<input type="submit" name="submitButton" value="Email">

Then in your code check the value of Request.Form("submitButton") and write
your logic around that.

Select Case Request.Form("submitButton")
Case "Credit Card"
' Do Credit Card stuff
Case "Email"
' Do Email stuff
End Select

You will have to deal witth the possibility of a user pressing <Enter>,
which will fire the default (first) submit button.

Bob Lehmann
 
What prevents you from having more than one submit button on a page?

Bob Lehmann
 
Nothing prevents it. But if you have 2 submit buttons they'll both do the
same thing (whatever the action is for the Form). He wanted to have them do
2 different things. If you use a JavaScript OnClick and the button type is
"submit" rather than "button" you can get strange results.
 
You could use a little JavaScript to prevent the form from being submitted
when they press enter. Ex:

<form onsubmit="return false">
<input type="button" value="Submit" onclick="this.form.submit()">

(There are other ways to do this as well, this is just one example)
 
Back
Top