?
Solved

Dropdown list

Posted on 2011-10-20
4
Medium Priority
?
257 Views
Last Modified: 2012-05-12
Hi,

I am validating my drop down list

if (DcFrm.DispStateBoxST.selectedIndex == 0)
{
  errorMsg += "Select a state\n";
  if (errorField==null) errorField=FRMAcc.DispStateBoxST;
 }

How can I say if it does not exist DcFrm.DispStateBoxST print error message
0
Comment
Question by:lulu50
  • 2
4 Comments
 
LVL 13

Expert Comment

by:dsmile
ID: 36998989
You need to provide more information:
1. what do you need exactly
2. how is your form constructed (html code should be ok)
3. where do you get DcFrm
0
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 1500 total points
ID: 36998990
if (DcFrm.DispStateBoxST)
{
if (DcFrm.DispStateBoxST.selectedIndex == 0)
alert("do some thing")
}
else
alert("not exist")
0
 

Author Comment

by:lulu50
ID: 36999037

I want to say if the drop down has no option to select send an error message. 

something like this but the code below is not working

if (!DcFrm.GetCity)
{
	errorMsg += "Select a city\n";
	if (errorField==null) errorField=FRMAcc.GetCity;
}
else
{
	if (DcFrm.GetCity.selectedIndex == 0)
	{
		errorMsg += "Select a city\n";
		if (errorField==null) errorField=FRMAcc.GetCity;
	}
}

Open in new window

0
 

Author Closing Comment

by:lulu50
ID: 36999086
Thanks
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…
Suggested Courses

569 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