Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Detecting Changes (Dirty Form)

Change one of the editors to make a form dirty. On an attempt to close the form, the onbeforeunload event will be executed and the "Confirm" dialog will be displayed.


v
v
Save Changes
Cancel Changes


This demo illustrates how to detect changes in a form and notify a user to save/cancel these changes before leaving the page.

For this, use the ASPxClientEdit.AttachEditorModificationListener method to attach a handler to the ASPxClientEdit's event which indicates whether a user modified the form's field values since the previous save. The new ASPxTextEdit.UserInput event allows tracking any changes within an editor.

After updating a form, the "Save Changes" and "Cancel Changes" buttons become available. When a user attempts to close the page without saving the changes, it raises the onbeforeunload event, and the "Confirm" dialog is shown.