matbeard
Junior Member
Posts: 4
Registered: 2/20/2006
Member Is Offline
|
| posted on 2/20/2006 at 03:52 PM |
|
|
Multiple submit buttons
I'm trying to use the Form Validator on a page with multiple submit buttons.
I'd like to have different sets of validation depending on which button is used to submit the form.
Can anyone work out how this would be possible?
Thanks.
|
|
|
tigra
Administrator
Posts: 1905
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 2/20/2006 at 05:21 PM |
|
|
you'll have to call the validation from onclick event of the button, instead of onsubmit event of the form. Create multiple validator objects and
call exec() on the one you want to use.
|
|
|
matbeard
Junior Member
Posts: 4
Registered: 2/20/2006
Member Is Offline
|
| posted on 2/20/2006 at 05:35 PM |
|
|
I thought about that but...
...a javascript 'return true' or 'return false' has no effect on a submit button's action... it submits the form regardless.
So adding onclick="return v.exec()" to the button doesn't validate the form at all -- it's just submitted.
Unless I've completely missed the point, that is... :-)
|
|
|
tigra
Administrator
Posts: 1905
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 2/20/2006 at 07:11 PM |
|
|
I tried
| Code: |
<form action="http://www.softcomplex.com/">
<input type="Submit" value="submit 1" onclick="return false">
<input type="Submit" value="submit 2" onclick="return false">
</form>
|
neither button submitted the form
|
|
|
matbeard
Junior Member
Posts: 4
Registered: 2/20/2006
Member Is Offline
|
| posted on 2/21/2006 at 09:28 AM |
|
|
Hmmm...
...really? I've have to investigate that further. It didn't seem to work when I tried.
I must have done something wrong.
Thanks for the advice.
|
|
|