Don’t warn on leave when save button clicked
Archived from the Xataface Users forum.
xyloweb — Mon Feb 13, 2012 2:51 am
Hi,
I use a javascript to warn user when is leave the current page but….
I don’t want a warn when the user click on save button !
How can I do that (simply of course…) ?
shannah — Tue Feb 14, 2012 11:18 am
This should be a default behavior of Xataface but haven’t gotten around to adding it.
- You have a boolean variable to track whether any changes have been made.
- You add js change handlers to all fields in form. If there is a change, you set the “changed” variable from step 1 to true.
- You add a submit listener to the form or the submit button that sets the “changed” variable to false.
- Your window on leave listener pops up a warning only if the “changed” variable is true.
(You could also get by without checking or changes and just making the changed variable default to true.
-Steve
xyloweb — Thu Feb 16, 2012 6:23 am
thanks for your repply shannah.
Is there a way to handler changes for all the fields without add handler to each of them ?
If I have add a field I must add a handler… !!!
How to add a handler for my record and no for each fields into the record ?