Wednesday, February 15, 2006

Tip: Ctrl+A, Ctrl+C before submitting text in a web form

Has this ever happened to you? You've typed a large amount of text into a form on a web page (such as the "body" field of an email in a web-based email application), then you click the button to submit the form. At that point, something goes wrong; the server returns an error, or the browser crashes, or whatever. The end result is that all that text you typed is gone; there's no way to Undo, and clicking the Back button won't help because either the browser crashed, or when you get back to the page where the form was located, you're presented with just a fresh blank copy of the form. You're left with the choice of re-typing everything you had entered, or just abandoning whatever it was you were trying to do. I've been extremely frustrated by this issue on more than one occasion!

A quick preventative measure for this kind of thing is a quick press of Ctrl+A followed by Ctrl+C when you're finished typing, before you click the button to submit the form. Ctrl+A is a shortcut for "Select All", causing all of the text in the current field to become selected. Ctrl+C is a shortcut for "Clipboard Copy", copying the form text to the clipboard. Then, even if the form data ends up getting lost for whatever reason after you submit, at least you have a copy of your text tucked away on your local machine's clipboard, which you can just Paste back into the form to re-submit.

It would be nice if web browsers in the future would include this type of failsafe automatically by making a temporary copy somewhere of any text that gets submitted on a form. The user could then retrieve the data if necessary if something goes wrong after the form is submitted.

Update 4/16/2008: Looking back over this post, in the previous paragraph, there are obvious security implications locally caching data such as login credentials, a credit card number, or other sensitive data, especially since the user might on a public workstation. It might be overkill for this problem, but perhaps the HTML standard could be extended to allow a particular form field to be marked as non-sensitive, which would be an indicator to browsers that the submitted data could safely be locally cached in an insecure fashion?

No comments:

Post a Comment