homepage Welcome to WebmasterWorld Guest from 54.197.19.35
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
FireFox remember form state/data
Tomazaz




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

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

 

kaled




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

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

Kaled.

Tomazaz




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

Unfortunatelly OnLoad event is not triggered when navigating to previous page with Back Button.

kaled




msg:1474188
 10:21 am on May 25, 2006 (gmt 0)

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

Kaled.

visu




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

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

Tomazaz




msg:1474190
 11:59 am on May 26, 2006 (gmt 0)

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.

Tomazaz




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

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?

texmex




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

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>

texmex




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

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.

mrhoo




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

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

[developer.mozilla.org...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved