} else if(ele.search_zonenm.value && !ele.search_zoneid.value) {
alert('Zone Number but no zone id');
return false;
}
return true;
}
</script>
Why use else's at all? Each conditional branch returns after all. ;)
aren't you too tired to always ask the same thing ?
can't you think by yourself ?
if ( bu.value ) {
if ( zoneid.value && !zonenum.value ) { blah 1 }
else
if ( !zoneid.value && zonenum.value ) { blah 2 }
}
else { blah 0 }
the "blah"s must return false
--
sm
> Something is not working on the validation script. ...
> but then I got a syntax error. thanks,
What was the error message, and what line in the script did it identify?
Rgds
Denis McMahon
There wasn't an error message but the user could perform the search
incorrectly. It is an enforced business rule to search only on both.
I believe I this one does work. I was testing on the wrong page or
something else. It is not elegant but it works.
not so much ... not so much ... if / else are the same everywhere ;-)
--
sm
Pretty much and you don't need an else if the previous conditional
clause exits the function. JSLint is good for spotting these issues.
Absolutely !
(posted too quickly :-( )
--
sm
You are assuming that the poster is an intelligent being. It is
however JRough, to whom intelligence is a foreign land.
You are assuming I know one "JR" (or "jr") from the next. That's why
people should use unique "handles" on Usenet, preferably their real
name.