Multiple select drop down poplulating sub drop down

S

scott

Hello all,

I am ripping my hair out over this and maybe someone could help.

I have a site that has groups and subgroups of those groups that all
have int id's.

I am trying to have a multiple select drop down (could select more than
one group) like the following:

1 - group a
2 - group b
3 - group c
4 - group d

and if you would select group a (id value = 1) and group c (id value =
3) the sub drop drop will populate (without having to reload) with the
values of those groups' sub groups:

1 - group a - subgroup 1
1 - group a - subgroup 2
1 - group a - subgroup 3
1 - group a - subgroup 4
3 - group c - subgroup 5
3 - group c - subgroup 6
3 - group c - subgroup 7
3 - group c - subgroup 8

Does this make sense???? Please help!!!!!
 
S

scott

Matt, thank you so much for the advice. It seems to be working quite
nicely. However, I cannot get the values which are integers and the
names for text.

here is the code below.









<script type="text/javascript">
var makeModel = new DynamicOptionList("alert_group","SUBGROUP");
makeModel.forValue("ALL PUBLIC").addOptions("NONE"); // Add options if
VALUE of option is selected
<cfloop query="get_group_type">
<CFQUERY Name = "get_sub_group" Datasource = #application.dsn#>
SELECT * FROM ACCOUNT_SUB_GROUPS
WHERE account_id = '#session.account_id#' AND group_id =
'#get_group_type.group_id#'
</CFQUERY>

makeModel.forValue("#group_title#").addOptions("ALL" <cfloop
query="get_sub_group"> ,"#sub_group_title#"</cfloop>);
</cfloop>

makeModel.forValue("POLICE").addOptions("SWAT","DETECTIVE","DISPATCH");
// Add options if VALUE of option is selected
makeModel.forText("FIRE").addOptions("COMMAND","CHIEF","CHEM"); // Add
these options if TEXT of option is selected




</script>

<TR>
<TD align="right" height="30" valign="top"><FONT SIZE="0" FACE="MS
Sans Serif"><B>Group (s):&nbsp;</B></FONT></TD>
<TD COLSPAN=2><SELECT style="width:269px; font:Arial, Helvetica,
sans-serif; font-size:12px" NAME="alert_group" multiple size="4"
class="text">
<cfif #parameterexists(session.group_id)# eq 'YES'>
<cfif #groups.sendpublic# eq '1'>
<OPTION VALUE="ALL PUBLIC"> ALL PUBLIC
</cfif>
<cfelse>
<OPTION VALUE="ALL PUBLIC"> ALL PUBLIC
</cfif>
<cfloop query="get_group_type">
<OPTION VALUE="#group_title#"> #group_title#
</cfloop>


</SELECT><br><font face="Arial, Helvetica, sans-serif"
style="font-size:9px">* - Hold down Ctrl button for multiple
selections.</font></TD>

</TR>





<TR>
<TD align="right" height="30" valign="top"><FONT SIZE="0" FACE="MS
Sans Serif"><B>Sub Group (s):&nbsp;</B></FONT></TD>
<TD COLSPAN=2>
<select style="width:269px; font:Arial, Helvetica, sans-serif;
font-size:12px" name="SUBGROUP" multiple size=5>
<script
type="text/javascript">makeModel.printOptions("SUBGROUP")</script>
</select><br><font face="Arial, Helvetica, sans-serif"
style="font-size:9px">* - Hold down Ctrl button for multiple
selections.</font>
</td>

</tr>
 
S

scott

Actually I just got it. Of course minutes after posting my previous
message.

It was using the following (addOptionsTextValue):

makeModel.forValue("#group_id#").addOptionsTextValue("ALL", "0" <cfloop
query="get_sub_group"> ,"#sub_group_title#"
,"#sub_group_id#"</cfloop>);

Thank you for all your help!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top