Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Confirm form changes


Go to End


2 Posts   2285 Views

Avatar
pmccarthy

1 Post

31 July 2007 at 11:14pm

Hi All,

I know it might be top secret information, but i have been searching for a similar script to the one you use which identifies a change to a form and gives the user the chance to save, discard or stay on page.

Would it be possible to get a little info on how that is done. I have seen some with Javascript, but they are really naff.

Any help would be appreicated.

Cheers,
Patrick in London

Avatar
elijahlofgren

Google Summer of Code Hacker, 222 Posts

1 August 2007 at 9:34am

> I know it might be top secret information, but i have been searching for a similar script to the one you use which identifies a change to a form and gives the user the chance to save, discard or stay on page.
This dialog was removed from the gsoc branch because to was slow to load and was replaced with a Javascript confirm() dialog which simply says:

Are you sure you want to navigate away from this page?
WARNING: Your changes have not been saved.
Press OK to continue, or Cancel to stay on the current page.

From what I understand, the form change detection is accomplished by serializing the form contents and then before the page is unloaded, the current values of the form are compared to the serialized values.

Hope this helps,

Elijah