• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using a drop down to populate another drop down using dynamic data

LEGEND ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

I know this question probably has been posed a million times...

I want to make 2 drop down lists. The first is static and have 3 options.

<select name="type" id="type">
<option value="1">Dogs</option>
<option value="2">Cats</option>
<option value="3">Rabbits</option>
<option value="4">Small & Furry</option>
</select>

When selected, the type needs to be passed to a sql statement:

<cfquery name="GetABreeds" datasource="request.dsn">
Select breed, name
From pets
where type = #form.type#
</cfquery>

And the results (GetABreeds) get used to populate the 2nd drop down.
<select name="type" id="type">
<option value="#dombreed#">#name#</option>
</select>

Anyone know where I can find how this is done. I found some, but they all
deal with static arrays.


TOPICS
Advanced techniques

Views

270

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

Anyone know where I can find how this is done. I found some, but they
all deal with static arrays.

Because when you are on the server static arrays is all you have access
to without sending a new request and refreshing the page, without using
other technologies.

Now, this kind of problem is exactly why technologies such as Ajax and
Flex have come about. You could use these to allow for the requesting
and receiving of data without refreshing the interface.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

I have a writeup on this on my blog

Linked HTML Form Selects using AJAX
http://www.intersuite.com/client/index.cfm/2007/2/25/Linked-HTML-Form-Selects-using-AJAX

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2007 Mar 23, 2007

Copy link to clipboard

Copied

Thats great, but you make reference to a cf_LinkSelect tag that I cannot
locate anywhere.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2007 Mar 23, 2007

Copy link to clipboard

Copied

LATEST
Ahh, nevermind, I found it on the page. Sharp download area.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation