Don't warn on leave when save button clicked

A place for users and developers of the Xataface to discuss and receive support.

Don't warn on leave when save button clicked

Postby 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…) ?
xyloweb
 
Posts: 11
Joined: Tue Oct 11, 2011 5:27 am

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

Postby shannah » Tue Feb 14, 2012 11:18 am

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

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

Postby 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 ?
xyloweb
 
Posts: 11
Joined: Tue Oct 11, 2011 5:27 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 27 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved