Hope this helps
<!--
/* Dynamically populate Workshop select box based on seleted stateID and then Facilitators based on workshopID */
// Create an array to hold Workshops and Facilitators
var WorkshopArray = new Array;
var FacilitatorArray = new Array;
var CohortArray = new Array;
// Define a custom Javascript object type to represent a single Workshop
function Workshop(workshopid, stateid, workshopname)
{
this.workshopid = workshopid;
this.stateid = stateid;
this.workshopname = workshopname;
}
// Define a custom Javascript object type to represent a single Facilitator
function Facilitator(facilitatorid,
{
this.facilitatorid = facilitatorid;
this.workshopid = workshopid;
this.lastName = lastName;
}
<!---New Code for CohortID--->
//Define a custom Javascript object to represent a Cohort
function Cohort(cohortid, facilitatorid, workshopid, name)
{
this.cohortid = cohortid;
this.facilitatorid = facilitatorid;
this.workshopid = workshopid;
this.name = name;
}
<!--- For each Workshop, append a new Workshop object to the array of Workshops --->
<cfoutput query="GetWorkshops">
WorkshopArray[WorkshopArra
</cfoutput>
<!--- For each Facilitator, append a new Facilitator object to the array of Facilitators --->
<cfoutput query="GetFacilitators">
FacilitatorArray[Facilitat
</cfoutput>
<!--- NEW CODE FOR COHORTID --->
<cfoutput query="GetCohorts">
CohortArray[CohortArray.le
</cfoutput>
/* Fill the Workshop select box based on the stateID*/
function fillWorkshops()
{
// Stop if there is no selected ParentID
if (document.formWorkshops.st
{
return;
}
var stateID = document.formWorkshops.sta
// Remove all options in the Workshop select box
document.formWorkshops.Wor
var ox=0;
document.formWorkshops.Wor
// For each item in the Workshoparray ...
for (var i = 0; i < WorkshopArray.length; i++)
{
// If the Workshop's stateIDFK is the same as the currently selected stateID
if (WorkshopArray[i].stateid == stateID)
{
// Put a new option in the Workshop select box
document.formWorkshops.Wor
}
}
document.formWorkshops.Wor
}
/* Fill the Facilitators select box based on the WorkshopID*/
function fillFacilitators()
{
// Stop if there is no selected ParentID
if (document.formWorkshops.Wo
{
return;
}
var WorkshopID = document.formWorkshops.Wor
// Remove all options in the Facilitators select box
document.formWorkshops.Fac
var ox=0;
document.formWorkshops.Fac
// For each item in the Facilitatorarray ...
for (var i = 0; i < FacilitatorArray.length; i++)
{
// If the Facilitator's WorkshopIDFK is the same as the currently selected WorkshopID
if (FacilitatorArray[i].works
{
// Put a new option in the Facilitator select box
document.formWorkshops.Fac
}
}
document.formWorkshops.Fac
}
<!--- NEW CODE FOR COHORTID && CohortArray[i].workshopid == WorkshopID--->
/* Fill the Cohorts select box based on the FacilitatorID & workshopID that has been Selected*/
function fillCohorts()
{
// Stop if there is no selected ParentID
if (document.formWorkshops.Fa
{
return;
}
var FacilitatorID = document.formWorkshops.Fac
var WorkshopID = document.formWorkshops.Wor
// Remove all options in the Cohort select box
document.formWorkshops.Coh
var ox=0;
document.formWorkshops.Coh
// For each item in the Cohortarray ...
for (var i = 0; i < CohortArray.length; i++)
{
// If the Cohorts's FacilotatorIDFK is the same as the currently selected FacilitatorID
if (CohortArray[i].facilitato
{
// Put a new option in the Cohort select box
document.formWorkshops.Coh
}
}
document.formWorkshops.Coh
}
-->
</script>
Then call it in your form
<select name="stateID" onChange="fillWorkshops()"
Main Topics
Browse All Topics





by: pinaldavePosted on 2007-01-21 at 22:15:20ID: 18363175
Hi,
e.com/Web/ WebDevSoft ware/ ColdF usion/Q_20 669813.htm l
e.com/Web/ WebDevSoft ware/ ColdF usion/Q_20 866579.htm l
e.com/Web/ WebDevSoft ware/ ColdF usion/Q_20 398517.htm l
This is popular questions. There are three similar questions answered.
http://www.experts-exchang
http://www.experts-exchang
http://www.experts-exchang
Regards,
---Pinal