05-16-2011 07:47 PM
I'm developing an app and need to save some form fields when navigating through the various pages [numbers and radio button states].By default the form is reset if you navigate to another page in the app and we need the values to stay put once entered.
I've got an alternate script that does recall the cookie when I focus on each field, but the goal would be to have all fields stay populated when you return to the page - instead of having to click each field to restore the value.See the full script here:Formretain.js
I'm new to BB development, but I've found the difference between the two scripts is how they load - the working one uses onfocus to run the function which populates the field, the failing one uses this statement:
if (window.addEventListener) window.addEventListener("load", setformobjects, false) else if (window.attachEvent) window.attachEvent("onload", setformobjects) else if (document.getElementById) window.onload=setformobjects if (document.getElementById) window.onunload=saveformvalues
Does webworks not like the window.onunload /load commands? Is there something different that might work there? This script [along with the rest fo the .JS] retains the fields perfectly when viewing on the PC, but doesn't do squat in the simulator.