搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Fields in the form are not getting cleared while reloading

more options

I designed a form which contains some text fields but if I try to reload the form by clicking the reload button in the browser, the page gets reloaded but it data in the text fields doesn't disappear but they used to stay as it is like before reloading. Can any one help me in this regard?

I designed a form which contains some text fields but if I try to reload the form by clicking the reload button in the browser, the page gets reloaded but it data in the text fields doesn't disappear but they used to stay as it is like before reloading. Can any one help me in this regard?

所有回覆 (7)

more options

press: ctrl + F5

more options

You need to bypass the cache to clear form data that is stored in the cache. You can do that via the above posted shortcut.

You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.

  • Hold down the Shift key and left-click the Reload button
  • Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
  • Press "Command + Shift + R" (Mac)
more options

Are you saying you are the author of the web page and you want all the fields to clear to their defaults on a "regular" reload? In that case, you may need to instruct Firefox not to cache the page, or use a script to reset the form on page load or pageshow.

This article has more information about such things: https://developer.mozilla.org/docs/Using_Firefox_1.5_caching

If you would like more specific assistance, can you mention what kind of page it is, for example, .php, .aspx, .html?

more options

cor-el said

You need to bypass the cache to clear form data that is stored in the cache. You can do that via the above posted shortcut. You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
  • Hold down the Shift key and left-click the Reload button
  • Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
  • Press "Command + Shift + R" (Mac)

It worked, thank you!!! But can you please tell me that why the reload button is unable to do the process whereas in browsers like Chrome, text fields are getting cleared by refreshing the page?

more options

rahuldecoded said

press: ctrl + F5

Extremely sorry for my response. Without reviewing it properly I responded. Once again I am sorry. Yes it worked and thank you!!!

more options

jscher2000 said

Are you saying you are the author of the web page and you want all the fields to clear to their defaults on a "regular" reload? In that case, you may need to instruct Firefox not to cache the page, or use a script to reset the form on page load or pageshow. This article has more information about such things: https://developer.mozilla.org/docs/Using_Firefox_1.5_caching If you would like more specific assistance, can you mention what kind of page it is, for example, .php, .aspx, .html?

Its a .html file

more options

With a .html file, you can create a script in the page which clears the form when the pageshow event occurs.

If your form has this id, for example,

<form id="form1">

You can clear the values in the form using this line of script:

document.getElementById("form1").reset();

Hooking that into the pageshow event is discussed in more detail in the article https://developer.mozilla.org/en/docs/Using_Firefox_1.5_caching