Hi I have a long form that is split into a wizard. To prevent the user from hitting browser back button and losing data I have the following:
window.onbeforeunload = function() {
return “Hitting back will cause you to lose all form data.”;
};
How would I insert a flag and apply to the last step so the form can be submitted properly?
Thanks,
You can set a variable on the last step to true and check against it, like this:
Without your current code I can’t say exactly where to insert this, but wherever your script moves to the last step, add a
okToSubmit = true;in there.