Solved

javascript validation

Posted on 2014-09-18
2
227 Views
Last Modified: 2014-09-24
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

0
Comment
Question by:erikTsomik
2 Comments
 
LVL 16

Expert Comment

by:Gurpreet Singh Randhawa
ID: 40332069
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

0
 
LVL 15

Accepted Solution

by:
Insoftservice earned 500 total points
ID: 40332097
Please provide complete code.

   <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>

values for both united states and Select is same.
Please change it to below and try, just alert what value you get when you change the select option
   <option value="0" <cfif attributes.SelectedState eq "">selected</cfif>>-- Select -- </option>
   <option value="US" >--United States--</option>
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add Clickable Links to Google Map Markers 3 28
PHP Form Calculate Total Price 10 40
Button and js nou working 3 6
JS does not refresh 6 15
This article discusses four methods for overlaying images in a container on a web page
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question