the following is what i have in my code, it works now for 2 levels. Now, i want to 3rd level drill down derived from the 2nd level. To make it clear, here is what i have:
I have a dropdown list #1 populated from the table (A, B, C,...), once i select item A, it will list out all the subgroup belongs to A (1, 2, 3,...). The 3rd level i want to do is select 1 and it will give another sub-subgroup within 1 (a, b, c, ...). Also, 3rd level (a, b, c...) sometimes can be NULL, if NULL i want it listed as N/A (or not applicable), and this is the query for 3rd level
<cfquery name="divisions" datasource="#webman_ds#">
select distinct organizational_group as office, organizational_subgroup as division
from webman_tssms_orgs
order by 1, 2
</cfquery>
So please help me what are all the syntax and code i put to make the 3rd level work and here are what i have:
--------------------------------------------------------------------------------
<cfquery name="offices" datasource="#webman_ds#">
select distinct organization as aaship, organizational_group as office
from webman_tssms_orgs
order by 1, 2
</cfquery>
<cfquery name="aaships" datasource="#webman_ds#">
select distinct organization as aaship
from webman_tssms_orgs
order by 1
</cfquery>
<script LANGUAGE="JavaScript">
<!-- Activate cloak
var maxLength = 11;
siteopt = new Array;
siteopt[0] = "";
<cfset jsarraycount = 1>
<cfset jstempaaship = " ">
<cfoutput query="aaships">
<cfif TRIM(jstempaaship) neq TRIM(#aaship#)>
siteopt[#jsarraycount#] = "#aaship#";
<cfset jsarraycount = jsarraycount +1>
<cfset jstempaaship = #aaship#>
</cfif>
</cfoutput>
var trueLength = siteopt.length;
var lst = siteopt.length;
catopt = new Array;
catopt[0] = "";
<cfset jsarraycount = 1>
<cfset jstempaaship = "">
<cfoutput query="aaships">
<cfif jstempaaship neq #aaship#>
catopt[#jsarraycount#] = "#aaship#";
<cfset jsarraycount = jsarraycount +1>
<cfset jstempaaship = #aaship#>
</cfif>
</cfoutput>
function changeMenu()
{
siteopt.length = 0;
menuNum = document.searchchoice.aaorg.selectedIndex;
if (menuNum == null) return;
if (menuNum == 0)
// NOTHING
{
siteopt = new Array;
siteopt[0] = new Option("N/A"
}
<cfsetting enablecfoutputonly="Yes">
<cfset jsaashipcount = 1>
<cfset lastOpt = 1>
<cfset jstempaaship = " ">
<cfoutput query="offices">
<!--- test for a new aaship --->
<cfif jstempaaship eq #aaship#>
<!--- same topic as last time through --->
<cfif len(#office#) GT 0>
<cfset lastOpt = lastOpt + 1>
<cfsetting enablecfoutputonly="no">
siteopt[#lastOpt#] = new Option ("#office#","#Office#"
<cfsetting enablecfoutputonly="no">
</cfif>
<cfset jstempaaship = #aaship#>
<cfelse>
<!--- not a new aaship - write the siteopt array for this --->
<cfsetting enablecfoutputonly="no">
<cfif jsAashipCount neq 1>
}
</cfif>
if (menuNum == #jsaashipcount#)
// they chose #aaship#
{
siteopt = new Array;
siteopt[0] = new Option(" ", "N/A"
siteopt[1] = new Option ("#office#","#office#"
<cfsetting enablecfoutputonly="yes">
<cfset lastOpt = 1>
<cfset jsaashipcount = jsaashipcount +1>
<cfset jstempaaship = #aaship#>
</cfif>
</cfoutput>
<cfsetting enablecfoutputonly="no">
}
tot = siteopt.length;
for (i = lst; i > 0; i--)
{ document.searchchoice.officegroup.options = null; }
for (i = 0; i < tot; i++)
{ document.searchchoice.officegroup.options = siteopt; }
document.searchchoice.officegroup.options[0].selected = true;
lst = siteopt.length;
} // Deactivate cloak -->
</script>
<form name="searchchoice">
<select name="aaorg" onChange="changeMenu(this.form)" size="1">
<script language="javascript"> with (document) {
tot = catopt.length;
writeln('<OPTION Disabled Selected>' +catopt[0]);
for (i = 1; i < tot; i++)
writeln('<OPTION Value="'+catopt+ '">' +catopt )};</script>
</select>
<select name="officegroup" size="1" length=20>
<script language="javascript"> with (document) {
writeln('<OPTION Disabled Selected>');
for (i = 1; i < maxLength; i++)
writeln('<OPTION Value="'+siteopt +'">' +siteopt);
writeln("</SELECT>"
for (i = maxLength; i > trueLength; i--)
{ SelectMenu.violation.options = null; }
changeMenu();};</script>
</form>
--------------------------------------------------------------------------------
thanks.
I have a dropdown list #1 populated from the table (A, B, C,...), once i select item A, it will list out all the subgroup belongs to A (1, 2, 3,...). The 3rd level i want to do is select 1 and it will give another sub-subgroup within 1 (a, b, c, ...). Also, 3rd level (a, b, c...) sometimes can be NULL, if NULL i want it listed as N/A (or not applicable), and this is the query for 3rd level
<cfquery name="divisions" datasource="#webman_ds#">
select distinct organizational_group as office, organizational_subgroup as division
from webman_tssms_orgs
order by 1, 2
</cfquery>
So please help me what are all the syntax and code i put to make the 3rd level work and here are what i have:
--------------------------------------------------------------------------------
<cfquery name="offices" datasource="#webman_ds#">
select distinct organization as aaship, organizational_group as office
from webman_tssms_orgs
order by 1, 2
</cfquery>
<cfquery name="aaships" datasource="#webman_ds#">
select distinct organization as aaship
from webman_tssms_orgs
order by 1
</cfquery>
<script LANGUAGE="JavaScript">
<!-- Activate cloak
var maxLength = 11;
siteopt = new Array;
siteopt[0] = "";
<cfset jsarraycount = 1>
<cfset jstempaaship = " ">
<cfoutput query="aaships">
<cfif TRIM(jstempaaship) neq TRIM(#aaship#)>
siteopt[#jsarraycount#] = "#aaship#";
<cfset jsarraycount = jsarraycount +1>
<cfset jstempaaship = #aaship#>
</cfif>
</cfoutput>
var trueLength = siteopt.length;
var lst = siteopt.length;
catopt = new Array;
catopt[0] = "";
<cfset jsarraycount = 1>
<cfset jstempaaship = "">
<cfoutput query="aaships">
<cfif jstempaaship neq #aaship#>
catopt[#jsarraycount#] = "#aaship#";
<cfset jsarraycount = jsarraycount +1>
<cfset jstempaaship = #aaship#>
</cfif>
</cfoutput>
function changeMenu()
{
siteopt.length = 0;
menuNum = document.searchchoice.aaorg.selectedIndex;
if (menuNum == null) return;
if (menuNum == 0)
// NOTHING
{
siteopt = new Array;
siteopt[0] = new Option("N/A"
}
<cfsetting enablecfoutputonly="Yes">
<cfset jsaashipcount = 1>
<cfset lastOpt = 1>
<cfset jstempaaship = " ">
<cfoutput query="offices">
<!--- test for a new aaship --->
<cfif jstempaaship eq #aaship#>
<!--- same topic as last time through --->
<cfif len(#office#) GT 0>
<cfset lastOpt = lastOpt + 1>
<cfsetting enablecfoutputonly="no">
siteopt[#lastOpt#] = new Option ("#office#","#Office#"
<cfsetting enablecfoutputonly="no">
</cfif>
<cfset jstempaaship = #aaship#>
<cfelse>
<!--- not a new aaship - write the siteopt array for this --->
<cfsetting enablecfoutputonly="no">
<cfif jsAashipCount neq 1>
}
</cfif>
if (menuNum == #jsaashipcount#)
// they chose #aaship#
{
siteopt = new Array;
siteopt[0] = new Option(" ", "N/A"
siteopt[1] = new Option ("#office#","#office#"
<cfsetting enablecfoutputonly="yes">
<cfset lastOpt = 1>
<cfset jsaashipcount = jsaashipcount +1>
<cfset jstempaaship = #aaship#>
</cfif>
</cfoutput>
<cfsetting enablecfoutputonly="no">
}
tot = siteopt.length;
for (i = lst; i > 0; i--)
{ document.searchchoice.officegroup.options = null; }
for (i = 0; i < tot; i++)
{ document.searchchoice.officegroup.options = siteopt; }
document.searchchoice.officegroup.options[0].selected = true;
lst = siteopt.length;
} // Deactivate cloak -->
</script>
<form name="searchchoice">
<select name="aaorg" onChange="changeMenu(this.form)" size="1">
<script language="javascript"> with (document) {
tot = catopt.length;
writeln('<OPTION Disabled Selected>' +catopt[0]);
for (i = 1; i < tot; i++)
writeln('<OPTION Value="'+catopt+ '">' +catopt )};</script>
</select>
<select name="officegroup" size="1" length=20>
<script language="javascript"> with (document) {
writeln('<OPTION Disabled Selected>');
for (i = 1; i < maxLength; i++)
writeln('<OPTION Value="'+siteopt +'">' +siteopt);
writeln("</SELECT>"
for (i = maxLength; i > trueLength; i--)
{ SelectMenu.violation.options = null; }
changeMenu();};</script>
</form>
--------------------------------------------------------------------------------
thanks.