Link to home
Start Free TrialLog in
Avatar of erikTsomik
erikTsomikFlag for United States of America

asked on

javascript validation

I am trying to validate the dropdwon that consists states and I also do the brake down by country. So when I select Select option it is validating properly , if I do select United State it does not validate at all

<select name="state" id="state" class="textbox">
   <option value="" <cfif attributes.SelectedState eq "">selected</cfif>>-- Select -- </option>
   <option value="" >--United States--</option>
   <option value="AL"  <cfif attributes.SelectedState eq "AL">selected</cfif>>Alabama </option>

</select>

if (validate[i].ruleType == "selectReq") {
				
				if (valueSelect(validate[i].fieldName) == false) {
					alert(validate[i].alertText);
					thisField.focus();
					Passed = false;
					break;
					break;
				}
			}

Open in new window

Avatar of Coast Line
Coast Line
Flag of Canada image

is this a complete code?

You can pass 0 to the united states and add on emore condition using the

if (valueSelect(validate[i].fieldName) == false || valueSelect(validate[i].fieldName) == 0) {

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Insoftservice inso
Insoftservice inso
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial