codedance/jquery.AreYouSure — pull request #20 by adz21c (2013-10-13 23:25:51+00:00)
Title: Multiple forms bypass

Problem
======
Consider a page that contains two forms, both with areYouSure applied. Change fields in both forms so they are both dirty and submit the first form. You are asked if you wish to stay - select to stay. Submit the second form - you are not prompted to stay or leave even though the first form is still dirty. This is because the first form was cleared from being dirty to submit but interrupted and not re-dirtied.

Solution
======
Store a reference to the form that is submitting then when checking for dirty forms filter the submitting form out of the results.

Outstanding issue
=============
If something else stops the submission process between areYouSure's onSubmit and the onBeforeUnload handling then a value will be left in submittingForm causing a form to be always filtered out of dirty checks. No idea how to solve this since there is no onSubmitExit event or such things. Something for people to be aware of I guess.