I wonder if anyone could help me in implementing a kind of "confirmation popup".
Here is what I'm trying to achieve:
Let's say my website consists of 2 columns. One of them contains a form (fields can be added dynamically) and the other one contains some buttons. Each of the buttons has a handler associated to it. However, some of the buttons, when clicked, cause reloading of the data in the form. So, if I don't save changes in the form and click on one of mentioned buttons, I lose my changes.
So, I want to implement a kind of popup that appears whenever any of those buttons is clicked (and of course there are unsaved changes in the form), informs me that I have unsaved changes in the form, lets me decide if I want to Continue/Cancel and depending on what I choose continues or stops execution of the button handler function.
The only way to do this I can think of at this point is to move all the logic from button handler functions to the function associated with 'Continue' button inside the modal dialog (I will have to pass event to the dialog).
Can anyone think of a possible solution?
Thanks a lot!