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

Stop the BackButton from being used?

Status
Not open for further replies.

Rexolio

Technical User
Aug 29, 2001
230
0
0
Is there a way to stop someone from using the back button?

I have a multipage form in an admin section. Its very controlled (in ASP) to prevent duplicate records. During the process, an Admin record is added and then a User Info record is added on another page which is linked to the newly created admin record. The problem is, if someone tries to submit the same admin record twice, it kicks them back - I don't want duplicate admin records. What some dummies are doing is submitting the admin record, getting to the next page where they should be creating the user info record that will be linked to the newly created Admin record, but then realize they want to add something, so they go "back", change whatever, then resubmit only to be kicked back totally. So now we have one Admin record, which is great, but no user info record for that particular admin record.

Is there a way to stop them from clicking "back" besides having the admin record pop up in a toolbarless window?
 
The browser guru in my areas says if the Back button is visible, there is no way to disable it, and no way to modify the history object that it uses. I had a similar problem recently. On the page that processess the form I set a cookie indicating the form had already been submitted. On the form page I check the cookie on submit, and if it's set, instead of submitting the form I give them a "you can't submit again" message.

Your FORM statement looks like this...
<FORM NAME=&quot;frm&quot; METHOD=&quot;post&quot; ACTION=&quot;xxx.asp&quot; onSubmit=&quot;return fnSave()&quot;>

Your fnSave function looks like this...
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function fnSave()
{
var nLoc, sCookies
sCookies = document.cookie
nLoc = sCookies.indexOf(&quot;SubmitStatus=Submited&quot;)
if (nLoc > -1)
{alert(&quot;Already submitted...&quot; )
return false;
}
return true;
}
</SCRIPT>

On your processing page, set the cookie...
Response.Cookies(&quot;SubmitStatus&quot;) = &quot;Submitted&quot;
(Be sure to do this near the end, when everything has been
processed SUCCESSFULLY).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top