onSubmit

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hey I just need to know if you can have 2 onsubmit=""
calls in your form tags

Thanks for all your help

Andy
 
-----Original Message-----
Hey I just need to know if you can have 2 onsubmit=""
calls in your form tags

No, only one per form.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Not sure what the poster has in mind exactly but you can
have as many onsubmit events as you like, eg
<form onsubmit="alert('event 1'); alert('event 2');">
although in most cases you'd want to validate something
and return true or false to either submit the form or
throw an error, eg
<form onsubmit="alert('this form will be checked
now');return checkForm(this);">
function checkForm(f){
if(f.txt1.value=='something'){return true}
// submit the form
else{return false}
// don't submit
}

Jon
Microsoft MVP - FP
 
Jon Spivey said:
Not sure what the poster has in mind exactly but you can
have as many onsubmit events as you like, eg
<form onsubmit="alert('event 1'); alert('event 2');">
although in most cases you'd want to validate something
and return true or false to either submit the form or
throw an error...

Jon
Microsoft MVP - FP

I'm not sure what the poster had mind mind either, but my guess was
that FrontPage form field validation, .NET, or a 3rd-party add-on was
adding its own event handler, and the posted wanted to add another.

In this interpretation, the question isn't, "Can a single event
handler take multiple actions?" but, "Can I chain multiple event
handlers?"

However, at this point, there's no way to tell which interpretation is
correct.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Back
Top