[thelist] How to validate a <select><option>
Warden, Matt
mwarden at odyssey-design.com
Mon May 22 21:41:40 2000
> function nullCheck()
> {
> if
>
(document.frm1.selInitiativeStat[document.frm1.selInitiativeStat.selectedInd
> ex].value == "")
> {
> alert("Error! Error! Does not compute!");
> return false;
> }
> }
Alternatively, if your "none selected" option will always be first, you can
do:
function nullCheck()
{
if (document.frm1.selInitiativeStat.selectedIndex < 1)
{
alert("Error! Error! Does not compute!");
return false;
}
}
This way, you can change the value of the first option without it mattering.
This simply checks to make sure the option selected is the second option or
later.
<quote-of-the-day src="anonymous">
"yeah, yeah. I get the 'e'. It's the 'commerce' part I'm having trouble
with. Does that mean we have to sell stuff?"
</quote>
Believe it or not, I got that today.
Rock on,
--
mattwarden
mattwarden.com