1

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)

4

3 回答 3

1

一个小小的网络搜索发现了这个页面:Clear Web Forms After Submit

<body>基本上在标签onloadunload事件的所有表单上调用 reset() 函数。

来自链接的代码:

<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>
于 2010-09-16T20:37:08.717 回答
0

可能由于 POST 调用而显示表单,这意味着浏览器不会缓存它。然后,如果另一个用户回击,浏览器会询问他们是否要重新发送请求,但即使他们这样做,您也会向他们显示一个空白页面。

于 2010-09-16T20:44:55.330 回答
0

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

于 2010-09-16T20:26:15.233 回答