Re: How to check that a form has been changed
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: How to check that a form has been changed

From: Matt Kruse <newsgroups@mattkruse.com>
Date: Mon May 01 2006 - 05:16:18 CEST

Randy Webb wrote:
> Depending on your definition of "changed", that may not be entirely
> true though. The simplest example would be a Select element. User
> chooses an option, changes his mind, changes it back to the original
> choice. Was it changed?

I guess you could play with the meaning of "changed". But in most cases, and
what I coded for, I think the developer is wondering if the form will submit
anything different than it would have when it was first loaded. To check if
any changes need to be saved to a database, for example, before navigating
away from a screen.

There is no way to detect at form-submittal time if a user changed a select
element, then changed it back. If you want that kind of fine-level control,
then you need to look at the onChange of each element and set some global
flag. But I don't see the value in this on a global form level. I can only
think of realistic cases where you'd want to handle it on a per-field basis.

-- 
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Received on Mon May 1 05:28:39 2006