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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dropdown list box help

Status
Not open for further replies.

olmos

Technical User
Joined
Oct 25, 2000
Messages
135
Location
US
I am having problems creating a drop down list box. I am not sure what
I am doing wrong. I need it to bring back all the selections with the correct type_description based on the os_type_id select. And when it does not have the computer_id just give me all the selections for os.

I just get #type_description# in the box
Thanks,
Olmos

<cfif IsDefined(&quot;Url.jplcomputer_id&quot;)>
<CFQUERY NAME=&quot;get_jplcomputer&quot; ....>
select .....and computer_id = #url.computer_id#
</cfquery>
</cfif>

<cfquery name=&quot;get_os&quot;
SELECT type_description
......
</cfquery>

Do I need to create 2 queries or combine, Is this the best way of doing this?
This is part of the code I am using that is not working for the dropdown box.

<cfoutput>

<select name=&quot;os_type_id&quot;>
<cfloop query = &quot;get_computer&quot;>
<cfif get_computer.os_type_id is #os_type_id#>
<OPTION Value = &quot;#get_computer.os_type_id#&quot; SELECTED>#type_description#
<cfelse>
<OPTION Value = &quot;#os_type_id#&quot; SELECTED>#type_description#
</cfif>

</cfloop>
</select>


</cfoutput>
 
try this:

<select name=&quot;os_type_id&quot;>
<cfoutput query = &quot;get_computer&quot;>
<OPTION Value = &quot;#os_type_id#&quot;<cfif os_type_id is os_type_id>selected</cfif>>#type_description#
</cfoutput>
</select>

:) Sylvano
dsylvano@hotmail.com

&quot;every and each day when I learn something new is a small victory...&quot;
 
Thanks for your help . It is almost working, but not quite. I only get the corresponding type_description and nothing else is in the drop down list . How do I get everything else to show up while the corresponding one is still selected. Also when I don't pass
the url.computer_id I get an error.
&quot;The QUERY attribute of the tag does not specify the name of an available query&quot;

Thanks
olmos.
 
I am not quite sure I understand your queries; can you post complete queries you have with the field names and specify exactly what you want to display based on which criteria Sylvano
dsylvano@hotmail.com

&quot;every and each day when I learn something new is a small victory...&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top