[thelist] js testing for empty fields

Kae Verens kverens at contactjuggling.org
Thu Feb 13 09:26:00 CST 2003

Tom Dell'Aringa wrote:
> if
> ((myForm.elements['myField'].value==null)||(myForm.elements['myField'].value==""))
>   //field is empty
> Is it really necessary to check for the null value? How would a field
> have a null value but not a "" value?

null means "has no value", but "" means "is an empty string" - there is
a difference.

you could also probably get away with this:

Kae Verens               _______\_   webworks.ie
work: www.webworks.ie       _____\\__   webhosts
play: www.contactjuggling.org  ___\\\___  design
kae:  kverens.contactjuggling.org _\\\\____ code

More information about the thelist mailing list