Click to See Complete Forum and Search --> : clearing form fields
carmen2u
05-07-2003, 04:59 PM
I have a login page for users to enter their username and password and upon authentication they are sent to the protected web site. Unfortunately, if a visitor hits his back button, his username still appears in the username field on the login page. Is there a way to clear that field, once a visitor enters the protected portion of the site? Many thanks for all assistance.
Bullschmidt
05-07-2003, 09:45 PM
That's pretty much how the back button works unless you disable it:
A1ien51's disable the Back Button
http://www10.brinkster.com/A1ien51/Scripts/BackButton.htm
What is going to happen, is when the page loads, it will send the surfer to the last page in their history.
Now if a person tries to go back to it, then it will send them directly back to the page they pushed the back button on!
Add this code to the header of your page:
<script>
history.forward();
</script>
JPS: Thus need to put the code on the page you don't want the user to be able to go back to.
And here is my version of it:
<script type="text/javascript"> <!--
// Disable browser's Back button on another pg being able to go back to this pg.
history.forward();
//-->
</script>
But if the page you put this on uses alert boxes for validation, may see that again.
carmen2u
05-08-2003, 09:29 AM
Thanks for your apt and succinct solution. That really came in handy.
Bullschmidt
05-08-2003, 04:12 PM
Cool!