views:

22

answers:

3

There will be a computer on display which users will write in their name, phone number, email and other information. We dont want users going back a page and grabbing ppls emails or other information.

How do i make it so when someone hits back the form no longer shows and a "sorry return to the first page" kind of thing. Theres a small chance there may be an agreement screen so hitting back and submitting another form and no seeing the screen may be trouble but i am not worried about that (or can say please put them on the same page).

I know its been asked but i havent seen any with this reason and the solutions i saw did not work (on firefox 3.6.10)

A: 

When the users enter information, save it and then send a redirect (through headers) to the page where users can enter their info.

singhspk
Your answer makes no sense. Save the info and redirect to a page to enter info... whats the point of writing it the first time and how does this stop the users from seeing data when pressing back
acidzombie24
I think the idea in the redirect is that when they hit back, they'll get the redirect page again, instead of the form. This wouldn't help if they jumped back 2 pages though.
zigdon
+1  A: 

A little web searching found this page: Clear Web Forms After Submit

Basically calls the reset() function on all forms on the <body> tag's onload and unload events.

Code from the link:

<html>
<head>
<title>A Self-Clearing Form</title>
<script>
function clearForms()
{
  var i;
  for (i = 0; (i < document.forms.length); i++) {
    document.forms[i].reset();
  }
}
</script>
</head>
<body onLoad="clearForms()" onUnload="clearForms()">
<h1>A Self-Clearing Form</h1>
This form data will self-destruct when you leave the current web page.
<form method="post" action="page2.php" name="test">
<input name="field1"/> Field One
<p>
<input name="field2" type="radio" value="One"/>One
<input name="field2" type="radio" value="Two"/>Two

<input name="field2" type="radio" value="Three"/>Three
<input name="field2" type="radio" value="Four"/>Four
<p>
<input type="submit" value="Submit Form Data"/>
</form>
</body>
</html>
JungleFreak
A: 

Could have the form displayed as a result of a POST call, meaning the browser won't cache it. Then, if another user hits back, the browser will ask if they want to resend the request, but even if they do, you display them a blank page.

zigdon
Interesting. I think this may work
acidzombie24