Form Dirty Bit

From MozillaWiki
Jump to: navigation, search

Feature Request: A Dirty Bit for Forms.

Rationale: As interactive use of forms for things like Wikis, Blog Entries, etc. becomes more common, and as users open more tabs and windows to perform these actions, it becomes increasingly likely that modified data in a form can be accidentally lost when a user navigates away from a page or closes a browser window without submitting the form.

This design issue has been addressed long ago in document-based applications and users are very familiar with a dialog asking them to confirm that they wish to close a window without saving the modified contents.

From my personal experience, I lose more to closing one window with a dirty form than I do closing a lot of tabs at once.

Suggested Design:

On User Action in a form, set a "page dirty" flag. On Submit or Reset, clear the flag.

On any action that closes a document with a form that is dirty, bring up a dialog to ask the user if they really want to close the document. Options should be Close (Continue?) and Cancel.

Sample Dialog Text: Warning: The Form "editform" on Page "Editing Form Dirty Bit - Edit -" has been modified. Closing the window or navigating away without submitting the form will cause your changes to be lost. Press Close to close the page or Cancel to return to the form."

Considerations: Suggest *not* allowing this to be hooked w/ an event. Spammers would love to be able to prevent you from closing their windows.

Consider Preference to use old behavior.

Suggested alternative text for dialog: "Are you sure you want to navigate away from this page? You have modified a form on the page '/pagetitle/'. If you close the page or navigate away, your changes will be lost. Are you sure you want to do this?" Then add buttons Yes and No. Think this would be easier for the user to grasp and more in keeping with existing messages. ~Toby

Better text has verbs on the buttons: "You have typed text into a form on this page. If you close the window/tab, this information will be lost." [Close and Discard Form Contents] | [Cancel]

I think that, to cut down on possible annoyance value, this should only trigger when the user has manually typed text (as opposed to autocomplete or inserted by JS) into an <input type="text"> or <textarea>, and then attempts to close the page (as opposed to navigating away). If they navigate away and notice their error, they can go back - and we normally preserve form state in this case. Gerv 03:14, 13 October 2006 (PDT)