Greetings,
I'm confused over this,
its strange.
I have two dynamic select boxes populated server side by coldfusion.
Both are initially populated the same, i.e. times of each record published
in descending order.
Also I build an array of these times
The first select box acts as a filter, so when they select a time from the
first
the second repopulates 40 records from that time descending.
This is what I have done,
<SCRIPT LANGUAGE="JavaScript">
<!--
<CFPARAM NAME="VARIABLES.li" DEFAULT="0">
<CFOUTPUT QUERY="q_built_from_historyID">
valueList[#li#] = "#LCASE(TIMEFORMAT(dt, 'hh:mm:tt'))#"
<CFSET li=li+1>
</CFOUTPUT>
function getTimeTo(){
var timeFromChk = document.interfacing.timeFrom
var getit =
timeFromChk.options[timeFromChk.selectedIndex].value
var x = 0
//define my loopcount
var loopCount = document.interfacing.timeFrom.length
//loop through select 1 values
for(var i = 0; i < loopCount; i++){
//increment x, were x will be starting point
for valueList array
x = i
if(document.interfacing.timeFrom.options[i].value == getit){
//now the values match set select 2
to null
document.interfacing.timeTo.length =
0
for(var j = 0; j < 40; j++){
//set select 2 starting from
x, were x is the index to use
//with the valueList array
document.interfacing.timeTo.options[j] = new Option(ValueList[x])
x = x + 1
}
break
}
}
}
//-->
</SCRIPT>
<form name="interfacing">
<select name="timeFrom" onChange="getTimeTo();">
<CFOUTPUT QUERY="q_built_from_historyID">
<OPTION VALUE="#LCASE(TIMEFORMAT(dt,
'hh:mm:tt'))#">#LCASE(TIMEFORMAT(dt, 'hh:mm:tt'))#</OPTION>
</CFOUTPUT>
</select>
<select name="timeTo">
<CFOUTPUT QUERY="q_built_from_historyID">
<OPTION VALUE="#LCASE(TIMEFORMAT(dt,
'hh:mm:tt'))#">#LCASE(TIMEFORMAT(dt, 'hh:mm:tt'))#</OPTION>
</CFOUTPUT>
</select>
</form>
Ok this works visually but I cannot extract values from the repopulated
select box.
I tried this,
document.interfacing.timeTo.length = 0
for(var j = 0; j < 40; j++){
//set select 2 starting from x, were x is the index to use
//with the valueList array
document.interfacing.timeTo.options[j].value = new
Option(ValueList[x])
document.interfacing.timeTo.options[j].text = new
Option(ValueList[x]) x = x + 1
}
now this I thought would have worked, but after the second select clears
itself,
it does not repopulate.
Sorry for the OT post, but if someone could guide me, thank you!!
J
..
..
______________________________________________________________________
Why Share?
Dedicated Win 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=coldfusionc
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