Page 1 of 1

Don't warn on leave when save button clicked

PostPosted: Mon Feb 13, 2012 2:51 am
by xyloweb
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…) ?

Re: Don't warn on leave when save button clicked

PostPosted: Tue Feb 14, 2012 11:18 am
by shannah
This should be a default behavior of Xataface but haven't gotten around to adding it.
1. You have a boolean variable to track whether any changes have been made.
2. 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.
3. You add a submit listener to the form or the submit button that sets the "changed" variable to false.
4. 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

Re: Don't warn on leave when save button clicked

PostPosted: Thu Feb 16, 2012 6:23 am
by xyloweb
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 ?