Reloading Dynamically-Altered DDLs on Browser Back-Button With JavaScript in Chrome

ebissdayx

New Member
In most browsers, if you use JavaScript to dynamically change the value of an HTML select/option drop down list in a form or add a new option on the fly, and then you click to another page (e.g. a results page) and then click back to the form page using the browser's back button, the browser will not "remember" the dynamically altered value.I came up with a trick to "repopulate" these select/option DDLs using JavaScript and a hidden form field to hold the value. The JavaScript function that added the new select option to the DDL also loaded it into an associated hidden field value at the same time. When the form page was (re)loaded by the browser back button, my custom JavaScript "rePop" function would read this value from the hidden field and then dynamically add it as an option back into the select/option field. It required a ~100ms delay after page loading (I think this was because there was a finite time required for the browser to repopulate the form fields; without the delay it would overwrite my repopulation), but it worked (and still works) perfectly on IE, Firefox and Safari for many years.But... along comes Chrome, and this function doesn't work in Chrome! I've tested it on a couple of different computers with Chrome, and all of them won't respond to the reload. I did some debugging using Alerts, and it looks like Chrome doesn't "remember" hidden field values that have been dynamically populated after the page load, while the other browsers do.I'll approach my question in two ways. First, is there something unique about how Chrome handles reloading form data on a back button versus the other browsers? If so, is there a way around it? Or is there a totally different approach I can or should use to reload dynamically entered/altered values in a DDL in general?
 
Top