Hello. I am trying to post this to new post but somehow I can't find the button and so will try to post it here. I have a checkbox with a dropdown list to choose for a number. What I wanted to do is to set the default to 0 (zero) the selected index when they uncheck my checkbox but my function doesn't work when I tried to call it:
function CheckDropDown(checkbox_person,number_select) {
if (!document.getElementById(checkbox_person).checked) {
document.getElementById(number_select).selectedIndex = document.getElementById(number_select).options[1];
}
else {
document.getElementById(number_select).selectedIndex = document.getElementById(number_select).options[0];
}
}
Here how I called it but it doesn't work. Please help.
This is how my form is...
<input name="checkbox_table" class="checkbox" type="checkbox" value=<?php echo $checkbox_table; ?> onclick="$('checkbox_table').checked=false; $('numbertable_select').selectedItem = 0;"
/>I wish to make reservations for
<select name="numbertable_select" id="numbertable_select" onchange="CalculateGrandTotal(this.value);" onclick="$('checkbox_table').checked=true;">
<?php foreach($numbertable_select as $select =>$prompt) : ?>
<option value = "<?php echo $select; ?>"
<?php echo helper_selected($select == $form['numbertable_select']); ?>
>
<?php safeEcho($prompt); ?>
</option>
<?php endforeach;?>
</select>table(s) at $550 per person.
<?php helper_error('checkbox_table');?>
So basically, I wanted to have a function to call when the checkbox is uncheck to set my number_select to 0. Any suggestions how to do it? I hope you can help me with this as soon as possible as I am running out of time. Thanks a lot.