[thelist] js testing for empty fields

Tom Dell'Aringa pixelmech at yahoo.com
Thu Feb 13 08:14:01 CST 2003


Hey all,

Normally I've always checked for empty fields in my forms by doing:

if(myForm.elements['myField'].value == "")
  //field is empty

But I have also seen this:

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?

Tom



=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com



More information about the thelist mailing list