Anyone have experience with the formToWizard.js plugin?
I need a little advice on using this plug in. I was able to modify it to add and remove classes for the stepIndex "nav" with the buttons, now I have another issue. I need to add an onbeforeunload alert on steps 2-4 of a 5 step form. I am able to disable it for the submit but can't disable it for the first step, here's what I have:
<script type="text/javascript">
var action_is_post = false;
$(document).ready(function () {
//this disables it for submit
$("form").submit(function () {
action_is_post === true;
});
//this should do it when step 0 is visible and has display block but doesn't
if ($("#step0").css("display") == "block") {
action_is_post === true;
}
window.onbeforeunload = function () {
if (action_is_post === false) {
return 'Using the browsers back, refresh or close button will cause you to lose all form data. Please use the Next and Back buttons on the form.';
}
}
});
</script>
I know its not ideal to do this to the user's browser, but my boss feels it necessary. Any ideas? Should I insert the #step0 flag in the formToWizard.js itself somewhere? it doesn't work as it should this way.
thanks
Kane Leins