Skip to content Skip to sidebar Skip to footer

How To Load Values From A Cookie To A Form Which Is In Wizardpane (dojo)

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 tryi

Solution 1:

How does this cookie crumble?

require(["dojo/dom-form", "dojo/cookie"], function(domForm, dCookie){

  function beforeFormSubmit() {
    dCookie(
         "formdata",
         domForm.toJson("myForm"),
         {expires: 5}
    );
  }
  function onWizardPaneShow() {
    var formData = dCookie("formdata");
    dojo.query("#myForm input").forEach(function ( inputEl) { 
       if(inputEl.name && formData[inputEl.name])
          inputEl.value = formData[inputEl.name];
    });
  }
});

Post a Comment for "How To Load Values From A Cookie To A Form Which Is In Wizardpane (dojo)"