Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-05-2012, 05:08 AM   PM User | #1
Ashwini1103
New to the CF scene

 
Join Date: Aug 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Ashwini1103 is an unknown quantity at this point
Please help me out...deadline is evening

Hi,
Please help me to do validation for the drop down in using java script.
The drop down field is in the table of every row. And the rows are creating dynamically.

The requirement is the drop down field is mandatory.
Ashwini1103 is offline   Reply With Quote
Old 09-05-2012, 01:38 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 944
Thanks: 7
Thanked 95 Times in 95 Posts
WolfShade is an unknown quantity at this point
SELECT tags can be validated in two ways - by selectedIndex, or by the value of the selectedIndex. (Notice the capital "I".. it must be capitalized, or it won't work.)

If your form name is "formName" and the select is named "selectName":
if(document.forms["formName"].selectName.selectedIndex == 0) means "if the select is in the first position" (it's a zero-based index.)

if(document.forms["formName"].options[document.forms["formName"].selectedIndex].value == "") means "if the value of the current selection is blank".
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:29 PM.


Advertisement
Log in to turn off these ads.