Entry
Is there an easy way to tell if no changes have been made on any of the elements of a form.
Jul 25th, 2002 17:54
Jay Jennings, Mark Paschal, John Bishop,
Declare a JavaScript variable on the document and set it to false. Have
onchange handlers for the form elements that set the variable to true.
Which means if someone changes a field that says Punkware to Pinkware
the flag will be set. But then if they change it back to Punkware
before the form is submitted, the flag is *still* set. yes, technically
the field changed, but that's probably not what you care about. You're
probably more concerned with whether the value of a field is the same
when the form is submitted as when the page loaded.
To do that you could walk through the elements of the form when the
<body onload()> event is triggered and save those values. Then when the
<form onsubmit()> event is fired, check the current values against the
ones you saved previously.