Hi All
I'm trying to find a javascript that can check if at least one textbox field of a group of fields contains data
In other words, if all textbox fields in a specified group of fields are empty, then you get an alert. But, if at least one of that specified group of textbox fieldnames has content, then the form allows submit
if any (name,email,addr1,addr2,phone) contains content, then okay to submit - but if all (name,email,addr1,addr2,phone) are empty, then alert "hi, there. ya gotta fill in something"
I've been searching for quite a bit, but no luck so far. Tons of great validation code out there, some that work for groups of checkboxes, and lots of "if empty, alert" code available for a single text field, but I've never found one that could scan a group of field names in the way that I mentioned.
alert( "Please enter some data." );
return false ;
Many thanks
------------------------------------------
I'm trying to find a javascript that can check if at least one textbox field of a group of fields contains data
In other words, if all textbox fields in a specified group of fields are empty, then you get an alert. But, if at least one of that specified group of textbox fieldnames has content, then the form allows submit
if any (name,email,addr1,addr2,phone) contains content, then okay to submit - but if all (name,email,addr1,addr2,phone) are empty, then alert "hi, there. ya gotta fill in something"
I've been searching for quite a bit, but no luck so far. Tons of great validation code out there, some that work for groups of checkboxes, and lots of "if empty, alert" code available for a single text field, but I've never found one that could scan a group of field names in the way that I mentioned.
Code:
if (form.name.value == "" OR form.email.value == "" OR form.addr1.value == "" OR form.addr2.value == "" OR form.phone.value == "") { alert( "Please enter some data." );
return false ;
Many thanks

------------------------------------------