July 30th, 2001, 04:06 PM
Join Date: Jul 2001
Time spent in forums: 1 h 30 m 22 sec
Reputation Power: 13
I'm validating a form and having problems with the && and ||.
My form has:
a radio button for determing what country: there are three radio butttons all with the same name
NAME="country" , the first radio button is checked by default and it's value is USA (the other 2 values are CANADA and OTHER)
a province text box:
and a text for another country (if USA or CANADA isn't checked)
I do not want validate the bill_province or bill_country_other text box, when the "country" radio button is set to USA (the first of three values). My problem is that it doesn't seem the && or || are working correctly.
Here's the piece of code that's not working:
Loop through the elements on the form, then assing an object as the field on the form.....
var fieldOrderProcObj = varFormName.elements[i];
then test for a non USA country AND the control's name should be either bill_province OR bill_country_other......
if((document.forms.bill_country.checked == false) && ((fieldOrderProcObj.name == "bill_province") ||(fieldOrderProcObj.name == "bill_country_other")) )
perform test to see if these 2 fields have value....
Again the code should say
IF the first of three radio buttons named bill_country is not checked AND
(( the field being tested is named bill_province) OR
(the field being tested is named bill_country_other)) then
perform a test to see if the field being tested has a value
I've double checked the control names and everything
Any help would be appreciated
~Just Say When ~