javascript - How to set up flag in wizard form to allow submit/override other function -
Hello, I have a long form that is divided into wizards. I have the following from preventing the user from hitting the browser back button and losing data:
window.onbeforeunload = function () {return "returning back will lose all form data."; };
How do I insert a flag and apply it to the last step so that the form can be deposited properly? Thanks,
You can set a variable on the last step and test against it, Like:
var okToSubmit = false; Window.onbeforeunload = function () {If (! OkToSubmit) "Hit back you must lose all form data."; }; // set okToSubmit = true; In the last step
without my current code, I can not say where it is to insert, but where your script runs in the last step, a okToSubmit = true ; / Code> there.
Comments
Post a Comment