I am trying to automatically fill a form from cookie data if the user already visited the site and checks the remember me checkbox...my cookie contains an array of data...i am trying to fill the form with array data..
here is the sample code
Cookie_check: function () {
var Cookie_Array = registry.byId("form").getChildren();
console.log(Cookie_Array);
var Cookie_Info = new Array();
dArrayUtil.forEach(Cookie_Array, function (item, i) {
Cookie_Info.push(item.value);
});
console.log(Cookie_Info);
//set cookie
cookie("cookie_name", dJson.toJson(Cookie_Info), { expires: 5 });
//get cookie infor into an array
var cookie_name = dJson.fromJson(cookie("cookie_name"));
console.log(cookie_name);
//fill the form using the cookie information
dArrayUtil.forEach(cookie_name, function (item) {
console.log(item);
registry.byId("form").setFormValues(item);
});
},
I have couple of questions-- 1. How to check if there is a cookie already and set the form with the cookie information?(in the above function i am missing the condition when i will be filling the form with cookie data (array)) 2. How do i pass this function on load of the wizard pane?
Any help greatly appreciated.
Thank you.