When the first radio button is selected, I need all three checkboxes to check and disable.
When the second or third radio button other_1 is selected, I need the three checkboxes to uncheck and enable again.
CODE (Non-functioning):
function validate_Days() {
var noOfDays = 0;
if (document.classic.r.value = "3daypass") {
noOfDays = 3;
}
if (document.classic.r.value = "2daypass") {
noOfDays = 2;
}
if (document.classic.r.value = "1daypass") {
noOfDays = 1;
}
if (noOfDays == 3) {
document.getElementById('cb1').checked = true;
document.getElementById('cb2').checked = true;
document.getElementById('cb3').checked = true;
}
else if (noOfDays == 2) {
document.getElementById('cb1').checked = false;
document.getElementById('cb2').checked = false;
document.getElementById('cb3').checked = false;
}
else if (noOfDays == 1) {
document.getElementById('cb1').checked = false;
document.getElementById('cb2').checked = false;
document.getElementById('cb3').checked = false;
}
}
EDIT: Removed disabling and used more useful names/values
I don’t understand what the code is doing, but here is how I would approach checking and unchecking the checkboxes. I also don’t understand why they are disabled when checked – disabled controls can’t be successful so won’t be posted to the server when the form is submitted.