dirty form

Dirty Form Module v1.0 Released!

CB1, INC. is proud to present the Dirty Form Module which built on the awesome Dojo Toolkit Module.

The Dirty Form module prompts a user when leaving a page with unsaved changes. There is support for snapshots which are essential for dynamic forms created by Dojo widgets!

The Dirty Form Module homepage can be found at http://cb1inc.com/projects/drupal/dirty-form-module.  If you should have any issues, please report them in the forum.

Dirty Form Module

Download Dirty Form Module v1.0

Overview

The Dirty Form module prompts a user when leaving a page with unsaved changes. When a page exited by clicking a link or a button not specified by the buttons to ignore, Javascript code scans the entire page for all text fields, textareas, select lists, checkboxes, and radio groups to detect a change. If a change is found, the user is prompted to whether or not they wish to proceed.

Configuration

The configuration for this module is very simple. You can access the Dirty Form Module configuration page by navigating to the following:

Administer > Site configuration > Dirty Form

Here you can define which pages you want the Dirty Form Module to process. Also, you can define the names of buttons for which you want to prevent the form from being process such as when you submit a page.

Playing Nice With Dojo

Suppose you use a Dojo widget on a page that has a text field in the template. Dojo will add the template to the DOM tree, then populate the value of the field. This causes the text field's "defaultValue" to be empty.

The Dirty Form Module writes a block of script at the bottom of the page and defines a Javascript variable called dirtyForm. After the widgets load, you can create a snapshot of the form elements by calling:

dirtyForm.snapshot();

When you leave the page, the current state is compared to the snapshot and the user will be alert about the unsaved changes.

Requirements

This module requires the Dojo Toolkit Module v1.1 or newer.

Compatibility

This module requires the Javascript event "onbeforeunload" which is currently only supported by Gecko/Mozilla and Internet Explorer based browsers. Opera and Safari do not support this event, so this module is rendered useless for users of those browsers.

Syndicate content