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

how to get submit to handle multiple events

Status
Not open for further replies.

ctenicki

Programmer
Joined
May 13, 2002
Messages
10
Location
US
I was wondering if its possible to have a submit button handle multiple events when clicked? So when clicked it would handle a ONCLICK="return validateUser" and at the same time be able to handle an ONSUBMIT event to prompt the user with a message text box based on some conditional logic? This onsubmit event would have to run through an "if, else if" conditional to check the value of of some drop down menus. Any ideas would be greatly appreciated.
Thanks
 
I would do it all in one event handler. much easier that way. Try using onSubmit and doing all your checks that way. Gary Haran
 
I agree with xutopia however you could use the javascript 'event' object to find out what button called the function.
 
Hello,

Why using a submit type input when you can simply use
a button type input?

Thus, you would have:
Code:
function do_things() {

if(cond1) {
do things
} else if (cond2) {
do other things
} else {
document.yourform.submit();
}

}
[\code]

<input type=&quot;button&quot; value=&quot;do things&quot; onclick=&quot;do_things()&quot;>

Have a good day.
 My Work...
[URL unfurl="true"]http://www.pariswave.com[/URL]
[URL unfurl="true"]http://www.tppro.com[/URL]
[URL unfurl="true"]http://www.france.jalpak.fr[/URL]
[URL unfurl="true"]http://www.tokyo-gas.co.jp/IR/ir_j.html[/URL]
[URL unfurl="true"]http://www.scandinavia.co.jp[/URL]
...and More...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top