SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old December 2nd, 2003, 08:48 AM
ragga ragga is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 2 ragga User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
dynamic populating list to combo

Hi

How to requery list box dynamically
I have list boxes and combo box one of them needs to list values related to whatever is chosen in the first box. I'd like to populate the second box on the select event of the first one The first one will g
I have tables one is subindicator, criteria_sql, and ref_model.ref_reg, so on
when they select the subindicator to populate a combo
the subindicator id will go and select cretiria_sql table
and select the sql query is like (Select gstype as fld1 From ref_type Order by fld1 ) then need to excute this and spit data into combo box. Here is the script below I have When I select it is spit one data because I am not able to assign as to run query (nested cfoutput)


<CFQUERY name="getSubIndicators" Datasource="#DSN#">
Select * From sub_indicator
</CFQUERY>
<CFLOOP index="k" From="1" to =

"#getSubIndicators.recordcount#">
<CFQUERY

name="getCriteria#getSubIndicators.sub_code[k]#"

datasource="#DSN#">
SELECT * FROM criteria_sql where sub_code =

#getSubIndicators.sub_code[k]#
</CFQUERY>


</CFLOOP>
function updatesel4(form)
{
form.criteria.length = 1;
form.criteria.selectedIndex = 0;
choice =

form.subIndicator.options[form.subIndicator.selectedIndex

].value;
<CFLOOP Index="count" from="1"

to="#getSubIndicators.recordcount#">
<CFOUTPUT>
if (choice == "#getSubIndicators.sub_code[count]#")
{

<CFLOOP index="x" From="1"

to="#Evaluate('getCriteria#getSubIndicators.sub_code[coun

t]#.recordcount')#">

(form.criteria.length)++;

<cfset t =

"#Evaluate('getCriteria#getSubIndicators.sub_code[count]#

.Sub_sql[x]')#">
<cfquery name="temp"

datasource="#DSN#">
#t#
</cfquery>
form.criteria.options[form.criteria.length -

1].text = "#temp.fld1#"
form.criteria.options[form.criteria.length -

1].value = "#temp.fld1#"
</CFLOOP>
}
</CFOUTPUT>
</CFLOOP>
}
<table>
<tr>
<td><br> <table height="18"

border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="Header"

align="center" valign="middle">
Sub Indicator:</td>
</tr>
</table></td>
<td><br> <select

name="subIndicator" class="small"

OnChange="updatesel4(this.form)" >
<OPTION VALUE =

"%"></OPTION>


<CFLOOP index="y" From="1" to="6">


<OPTION VALUE = ""> </OPTION>


</CFLOOP>
</select></td>
</tr>
<tr>
<td><br> <table height="18"

border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="Header"

align="center" valign="middle">
Criteria

Selection:</td>
</tr>
</table></td>
<td class="small"><br>
<select name="criteria"

size="5" multiple class="small">
<option VALUE =

"%"></option>
<CFLOOP index="y" From="1"

to="50">


<OPTION VALUE = ""> </OPTION>


</CFLOOP>
</select>
<input type="submit"

name="Submit2" value="< ">
<input type="submit"

name="Submit3" value="<<">
<input type="submit"

name="Submit4" value=">>">
<input type="submit"

name="Submit5" value="> ">
<select

name="criteriaSelect" size="1" multiple>
</select>
</td>
</tr>

Reply With Quote
  #2  
Old December 2nd, 2003, 10:20 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
I don't know enough about Javascript to comment on your code, but you are sort of reinventing the wheel on this. There are some custom tags out there for free that will do this (cf_twoselectrelated and cf_threeselectrelated), and there is the QForms Javascript API that does this and a whole lot more. www.pengoworks.com. Hope that helps.

Brian

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > dynamic populating list to combo


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway