Thread: check if empty
View Single Post
  #4 (permalink)  
Old March 7th, 2004, 09:17 AM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Quote:
quote:Originally posted by planoie
 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.
Surely length is a property not a method? :)

--

Joe
Reply With Quote