View Single Post
Old 03-10-2005, 09:06 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,544
sde is on a distinguished road
here is a trim function .. you could trim whitespace off the input and then validate.

Code:
 function trim(str){
   return str.replace(/^\s*|\s*$/g,"");
}
function atleastonenonemptyfield() {
 if (trim(contactform.name.value) == "" && trim(contactform.email.value) == "" && trim(contactform.addr1.value) == "" && trim(contactform.addr2.value) == "" && trim(contactform.phone.value) == "" && trim(contactform.zip.value) == "") { 
    alert( "Please fill in at least one box" ); 
    return false; 
  }
}
i haven't actually tested that, but it seems like it should work.
__________________
Mike
sde is offline   Reply With Quote