Forum Moderators: open

Message Too Old, No Replies

location.href and Backbutton

         

RayYates

3:14 pm on Feb 4, 2010 (gmt 0)

10+ Year Member



Using window.location=url makes it impossible to use the back button so, in my Javascript script I replaced window.location=url with window.location.replace(url) so that users can click the back button.

My problem is that I have dynamic form fields that the user must selected before clicking a submit button. The redirection url is constructed via Ajax from the form selections.

When the back button is clicked The screen returns to the previous state, but the selections are blank and must be re-entered.

Is there any way to click the back button and retain the previous form values?

daveVk

1:59 am on Feb 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think this is an issue with dynamic form fields, try adding a static form field and see if it has same problem.

I assume the browser only holds form data (between pages) for fields that existed on page load, just my guess.

RayYates

2:17 am on Feb 5, 2010 (gmt 0)

10+ Year Member



Unfortunately, that makes a of of sense and I can see why it doesn't work. Is their any way to triger a javascript event when the page is entered via the back button?

daveVk

3:40 am on Feb 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In IE onload fires, in firefox onPageShow, opera
history.navigationMode='compatible', others ?

Maybe some of the libraries have cleaner solution !