evergreean43
Technical User
I am trying to check my text and textarea fields on my update form to make sure a field value was changed before going to action page. If none were changed and someone hits submit button it should pop up message saying: You did not update any information for this form submit.
Please advise because my below attempt not working where it pops up the message everytime I submit. I assume my problem is in the myField.type conditions but not sure:
Please advise because my below attempt not working where it pops up the message everytime I submit. I assume my problem is in the myField.type conditions but not sure:
Code:
function chkUpdate(myedit)
{
var myField, myValue, i, j;
i = 0
while (myField = myedit.elements[i++])
{
if((myField.type == 'text') || (myField.type == 'textarea'))
{
if (myField.value != myField.defaultValue)
{
return theChange(myedit);
}
break;
}
}
alert("You did not update any information for this form submit.");
return false;
}
function theChange(myedit)
{
//info was edited, go to action page
return true;
}