No, this doesn't do anything. I have to be doing something wrong because even if I set all the return statements to false, the page still gets submitted. Here's what I have:

var btnPress = false;
function verify () {
  if (btnPress) {
     return false; }
  else { btnPress = true;
     return false; }
return false; }

<FORM action="disableSubmitFinal.asp?i=<%=sTitle%>&amp;n=<%=sName%>" method=POST id=frmEmail name=frmEmail onSubmit="JavaScript:verify();">

I put some alert statements in the function so I know it does get run, and the btnPress variable changes appropriately. But return false doesn't seem to stop the form from submitting.

Bj wrote:

OK I will put my JS head on properly.

If a form has an onSubmit() property that calls a script, then if that script returns true the submit will take place, but if false, it won't be submitted.

So this code should stop the form being submitted more than once:

<script>
var btnPress = false;
function verify ( ) {
 if (btnPress) return false;
 else {
   btnPress = true;
   return true;
 }
}
</script>
<form onSubmit="JavaScript:verify( );"...

Obviously I can't test easily, as on my local system the submit is instant and your situation is the original form remains on screen for some time.


Next question what is the form's 'action='? If not specified, the page will just refresh, the inputs will all empty and the button will work as well as before. Well I had to ask.

____ • The WDVL Discussion List from WDVL.COM • ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or use the web interface http://e-newsletters.internet.com/discussionlists.html/
      Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.





____ • The WDVL Discussion List from WDVL.COM • ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
      Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to