double submit problem with history.back() on firefox and safari

D

DarthOptimus

Hi,

There is javascript code on my jsp to prevent double submission of a
form:

<SCRIPT type="text/javascript" language="JavaScript">

var firstSubmit = true;

function isFirstSubmit() {

returnValue = firstSubmit;

firstSubmit = false;

return returnValue;
}

</script>

on submit it calls a validation function at the end of which is the
following

if(isFirstSubmit()) {
return(true);
}
else {
return false;
}

This prevents double submits well but if I press the back button on the
next page (which calls history.back(1) it still has firstSubmit set to
false (when done in Firefox and Safari) although it works in IE because
it seems to reload the page which would reset the variable,

Is there any way to reset the variable without having to click the
reload button on the browser for Firefox and Safari?

Thanks for your help!
 
D

Dr John Stockton

JRS: In article <[email protected]>,
dated Wed, 7 Jun 2006 02:06:36 remote, seen in
news:comp.lang.javascript said:
if(isFirstSubmit()) {
return(true);
}
else {
return false;
}

Better written as

return isFirstSubmit()

unless you are paid for coding by the yard.

See sig lines 2, 3.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top