...

View Full Version : Check Form update not working with Select element



florida
11-08-2006, 06:02 PM
I have an Update form where I check if any values were changed after someone submits the form.

If no values changed then message pops up and says:
You did not update any information for this Form.
The form will only go to the action page if a value is changed.

It works great but cant get it to work after I add a validation check on select element.


Here is my validation check function that I use for onSubmit:


e=myform.elements;
for (i;i< e.length;i++)
{
if ((e[i].type == 'text') || (e[i].type == 'textarea') || (e[i].type == 'select'))
{
if (e[i].value != e[i].defaultValue)
{
return true;
}
}
}
alert("You did not update any information for this Form.");
return false;


The above checks for text and textarea elements only for changes and wont work with select element.

My select part of the form:


<form....
<select name = "myname">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
..
</form>

A1ien51
11-08-2006, 06:26 PM
Becauase it does not have that property

Eric

florida
11-08-2006, 06:34 PM
Anyway I can add or check select element in my update form using JavaScript?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum