Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select ALL from dropdown list 1

Status
Not open for further replies.

tina2

IS-IT--Management
Joined
May 1, 2001
Messages
169
Location
US
I have a dynamically poulated dropdown in which the first option is "All"
I already figured out how to do that part, but here is my problem:

I would like to display different results if the user selects All as opposed to a single option.

(i.e. If they select a single policy, I display the policy Name at the top of the page but I would like to include the polciy name in the resulting table if "all" is selected)

Here is my dropdown list:
<cfselect name=&quot;Policy_List&quot;>
<cfoutput>
<option value=&quot;#valuelist(qGetPolicy.PolicyID)#&quot;>All</option>
</cfoutput>
<cfoutput query=&quot;qGetPolicy&quot;>
<option value=&quot;#qGetPolicy.PolicyID#&quot;>#qGetPolicy.Name#</option>
</cfoutput>
</cfselect>

Here is how I refer to it in my query:

WHERE Limit.PolicyID IN (#Policy_List#)

If I give the ALL option he value of &quot;ALL&quot; instead of &quot;#valuelist(qGetPolicy.PolicyID)#&quot;

and try to change the valuelist later, my query still tries to evaluate the word &quot;ALL&quot;...

Can anybody tell me how to get the value of the selection??

Many Thanks,
Kristine


 
Try removing the </option> tags. You dont need them at all.
 
Thanks for the tip, but it really doesn't solve my problem.
The form behaves the same with or without them...
 
Try removing the cf from <cfselect> and </cfselect> tags.
 
The select list works just fine either way. That is not my problem. My problem lies in finding out whether the user has selected &quot;all&quot; or an individual policy from the dropdown list.

IF they have selected all, I would like to display certain items in the results page. ELSE, I would like to disply something different...

I just can't figure out how to structure it ;-)

Kristine
 
Try either checking for a comma in the Policy_List field:

<cfif Policy_List CONTAINS &quot;,&quot;>

or checking the list length of that field:

<cfif listlen(Policy_List) GT 1>

Either one will tell you if they selected your &quot;all&quot; option or one of the individual ones.
 
That was what I was looking for!!
Thanks Y'all! Now I can get on with my day.

Kristine
 
Lotruth,

Actually you DO need </option> tags in the current (and all future) specs of HTML. All tags need to be closed. That includes &quot;empty&quot; tags, which have a special syntax:
[ul][li]
Code:
<br>
becomes
Code:
<br />
[/li]
[li]
Code:
<img src=&quot;foo.jpg&quot;>
becomes
Code:
<img src=&quot;foo.jpg&quot; />
[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top