Thread: check if empty
View Single Post
  #2 (permalink)  
Old March 7th, 2004, 09:04 AM
planoie's Avatar
planoie planoie is offline
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

if(!text.value))

A) The syntax is wrong. It should be:

if(!text.value)

B) This test will only tell you if there is a valid "value" property. There will always be a valid value property, but it might be blank. So you must test accordingly:

if(text.value.length()==0)


You may also want to look into testing this field with a phone number regular expression.

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote