Detect if user has changed form data
| From: | Ide, Jim | Date: | Tue, 13 Mar 2001 13:15:22 +0000 |
| Subject: | Detect if user has changed form data | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-43650@lists.php.net to get a copy of this message | ||
Is there an easy way to detect if a user has changed
the values in the fields of an HTML form? I want to
be able to check this during the onUnload event and
warn the user that he/she has not clicked the "Save"
button to save changes to the form fields.
The only way I can see to do this is to use JavaScript
to loop thru the variables and compare the current
(possibly changed) value to the value in the defaultValue
property. I'm hoping that there is a "UserHasChangedFormVariables"
property (or something similar) that I don't know about that someone
will tell me about :)
A pointer to existing code that does this would be appreciated.
Many thanks -
Jim