PDA

View Full Version : how to fix length of combobox dynamically



tuncerf
09-11-2006, 06:52 AM
Hi all,
I hava 2 comboboxes, one of which changes its options according to selected value of the other by javascipting.

<script language='JavaScript' type='text/javascript'>
<!--
function changeMenu(value){
var i=value ;
i++ ;
for(var j=0; i < 24; i++,j++){ document.editConstraint.selectTime_to.options[j] = new Option(i,i);
if((value!=0) && (i==23)){
j++;
document.editConstraint.selectTime_to.options[j] = new Option(0,0);
}
}
}
-->
</script>

Well in first time if I choose 2 in first combobox,the second one shows values between 2 and 23 and also 0.This is what i want.But then if I choose 16 in first before submitting the first selection, the second one shows 17-23 ,0 and 11-23 also a 0.How can i fix the length of the combobox to not to show 11-23 and last 0 which remain from first selection?

jscheuer1
09-12-2006, 07:52 AM
I think I would need to see more than that. Could you supply a link to the page?

If what you want to do is actually remove and/or replace options, you might want to consider a different approach. You also might want to consider simply having for the second select - various selects available with all but the default one display:none; then switch the display to the desired select on the basis of the item selected in the first select.

Also - could you please be a little more clear as to what you want to have happen?