macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Creating dynamic pulldown

Subject: Creating dynamic pulldown
From: "Olivia Crazy Horse" <webforumsuser@xxxxxxxxxxxxxx>
Date: Mon, 29 Sep 2008 00:40:44 +0000 (UTC)
Newsgroups: macromedia.coldfusion.cfml_general_discussion

I use the following code to create a dynamic pulldown list :

 <select name="buyerSite" style="width:160px;">
 <option selected value="0"><< -- Select One -- >></option>
 <cfoutput query="qryGet_Site"> 
 <option value="#qryGet_Site.buyersite#">#qryGet_Site.buyersite#</option>
 </cfoutput> 
 </select>

 It seems to work when I make a selection from the pulldown. But I am a little 
confused about the option selected value = "0" statement. When the form is 
first displayed, << -- Select One -->> is displayed in the pulldown window. If 
I decide not to make a selection, is the value "0" being passed ?

 In my javascriptt edit, I have if (formName.buyerSite.selectedIndex.value == 
"0".....alert(messese)...etc.,
 but nothing is displayed and the form processes.

 I tried "0" and 0 and the javascript does not work. What am I doing wrong ? I 
just need to validate if a pulldown option was selected or not.

 Thanks


<Prev in Thread] Current Thread [Next in Thread>