-
Combo Box Validation
I posted this in the Newbie section, but I think that may have been the wrong place to post.
Not a clue what I'm doing. This is part of some javascript someone wrote for me. It was originally designed to validate a text box, but I've changed it to a combo box and now, no matter what I do, it won't accept anything in the combo box.
<----------------------CODE CHUNK---------------------->
if(document.guestbook.GRAD.value.length <2)
{
++i;
msg += 'You must supply your graduation year\n';
document.guestbook.GRAD.style.background=errcolour;
document.guestbook.GRAD.style.color='#FFFFFF';
}else{
document.guestbook.GRAD.style.background='#FFFFFF';
document.guestbook.GRAD.style.color='';
}
<-----------------------END CHUNK---------------------->
I've also tried
if(document.guestbook.GRAD.value == '')
and that didn't work either.
Thanks!
-
Hi,
What do you mean by combo box? In other words, would you mind posting some html?
if you mean a selection list, you need to follow the DOM -- document.formname.selectName.options[document.formname.selectName.selectedIndex].value
Vinny
-
That did the trick, thanks!
-