Hi Graham,

put your relating values in javascript arrays

<SCRIPT LANGAUGE="JAVASCRIPT">
var newValueList1 = new array()
var newValueList1 = new array()
var newValueList1 = new array()
and so on...

<cfoutput>
populate your arrays....
</cfoutput>

function newPopulate(){
        var selectOneObj = document.formName.selectBox1
        var getit = selectOneObj.options[timeFromChk.selectedIndex].value
        var loopCount = selectOneObj.length
        
        for(var i = 0; i < loopCount; i++){
                if(selectOneObj.options[i].value == getit){
                        var arrayVal = selectOneObj.options[i].value
                        document.formName.SelectBox2.length = 0
                                for(var j = 0; j < newValueList.length;
j++){
        
document.formName.SelectBox2.options[j] = new
Option(arrayVal[j],arrayVal[j])
                                }
                }
        break
        }
}
</SCRIPT>

<form name="formName">

<select name="selectBox1">
        <option value="newValueList1">department1</option>
        <option value="newValueList2">department2</option>
        <option value="newValueList3">department3</option>
        <option value="newValueList4">department4</option>
<select>

<select name="">
        <option value="selectBox2"></option>
</select>

</form>

I just wrote this but haven't tested it, but its certainly a step in the
direction your looking to go,
if you still have problems let me know,

Respectfully,

J


-----Original Message-----
From: Graham Pearson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 12:29 PM
To: CF-Talk
Subject: Select Boxes Populating another select box


CF-Talk,

I am looking for code that for an application that I am working on that 
when a user selects a Department from an DropDown Menu, that it 
automatically populates another dropdown menu based on what was selected in 
the first select box. Is their a way to handle this. Currently I am having 
the user press submit on the first select box so it can populate the second 
select box to get the Department:SubDepartment value

----------------------------------------------------------------------------
---------------
Graham Pearson, System Administrator / Certified Webmaster
Northern Indiana Educational Services Center
Http://support.niesc.k12.in.us  Email: [EMAIL PROTECTED]

Voice (574) 254-0444 Ext 108 / (800) 326-5642 Fax: (574) 254-0148
----------------------------------------------------------------------------
----------------


______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to