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: Evertjan. <exjxw.hannivoort@interxnl.net>
Date: Mon May 01 2006 - 08:59:18 CEST

Matt Kruse wrote on 01 mei 2006 in comp.lang.javascript:

> 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.
>

Won't this do [on a perfield loop onSubmit()]?

if (myInput.value!=myInput.defaultValue) ...

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Received on Mon May 1 05:28:43 2006