Welcome to WebmasterWorld Guest from 54.166.224.46

Forum Moderators: open

Message Too Old, No Replies

FireFox remember form state/data

     
11:55 am on May 23, 2006 (gmt 0)

5+ Year Member



Hello,

I use JavaScript in HTML form to disable Submit button while submitting form. In next page user get result of submitted form and he/she can click Back button in browser to submit another form. The problem is in FireFox, when user return to form using Back button he/she get disabled submit button from previous submit.
Also all data in form remain from previous fill.
Any suggestion how to clear state in form? In IE everything works fine, clear form on Back button.

Tomas

1:19 pm on May 23, 2006 (gmt 0)

WebmasterWorld Senior Member kaled is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Use javascript to renenable the submit button when the page loads.

Kaled.

7:26 am on May 25, 2006 (gmt 0)

5+ Year Member



Unfortunatelly OnLoad event is not triggered when navigating to previous page with Back Button.
10:21 am on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member kaled is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Try placing the script at the bottom of the page rather than triggering it with onload.

Kaled.

4:02 am on May 26, 2006 (gmt 0)

5+ Year Member



load page with javascript location object
i.e
write this code for back button.
window.location.href="http://domain name.com/filename.ext";
i think this will do the need for u
11:59 am on May 26, 2006 (gmt 0)

5+ Year Member



Try placing the script at the bottom of the page rather than triggering it with onload.

The same problem, FireFox do not trigger any event or JS when back button is pressed.

12:04 pm on May 26, 2006 (gmt 0)

5+ Year Member



load page with javascript location object
i.e
write this code for back button.
window.location.href="http://domain name.com/filename.ext";
i think this will do the need for u

Could you explain where to put this code? What is the event for back button?

1:58 pm on May 26, 2006 (gmt 0)

5+ Year Member



I know the issue you are on about. But in my experience the onload function DOES fire when the form page is returned to, using the back button. Are you sure you're onload event handler is working. I just created the following page as a test, and it works fine in firefox.

It is definately the onload handler clearing the form as, without it, the previous data is still in the input box.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<HEAD>

<script type="text/javascript">

function trydis()
{
document.forms["thing"].reset();
}
</script>

</HEAD>
<BODY onunload="trydis()">

<form name="thing" method="post" action="test.html">
<input name="something" type="text" >
<input type="submit" value="submit">
</form>
</body></html>

2:02 pm on May 26, 2006 (gmt 0)

5+ Year Member



Ooops.
Sorry, just realised that I used the unloadevent on my previous post so you may be right about the onload event.

anyhow, it may be the answer to your problem.

2:35 pm on May 26, 2006 (gmt 0)

5+ Year Member



This article explainus what is happening
and how to prevent it:

[developer.mozilla.org...]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month