This project is not covered by Drupal’s security advisory policy.

Dirty Forms popup warning at onBeforeUnload.

The Dirty Forms module provides a javascript behavior that checks forms before users leave the page, warning them if they are about to loose changes and providing an option to remain on the page.

The module provides a configuration form that allows setting up a list of forms that should be excluded from the dirtyForms behavior.

This feature is based on the onBeforeUnload event of the window object which, at the time of writing, is only supported by IE4+, Mozilla Firefox, Google Chrome. Those using other browsers (or when javascript is not enabled) won't be warned when leaving dirty pages. Ah, c'est la vie!

The Dirty Forms module requires the onBeforeUnload API.

dirtyForms behavior details:

The following element types are processed (unless they are excluded):
- Form elements of type text, password, textarea, select, radio, checkbox and hidden.

The following elements are excluded from processing:
- Forms and form elements that have the CSS class 'dirtyforms-exclude'.
- Forms with no id attribute.
- Form elements with no name attribute, because are considered client-side elements (ie. these elements are not sent to the server).
- Form elements of type submit, button, reset, image and file.

Forms and form elements added or removed dynamically, if not excluded by any of the above mentioned rules, are considered dirty.

Project information