Good Afternoon,
I have 7 checkboxes on a form. I want to only allow 1 of those to be selected. So, when a user selects 1 all others should be hidden. I am a bit confused about where I would put the code to do this....here is the code I currently have that allows the user to add some text when a checkbox is selected:
Thanks in advance,
Sam
I have 7 checkboxes on a form. I want to only allow 1 of those to be selected. So, when a user selects 1 all others should be hidden. I am a bit confused about where I would put the code to do this....here is the code I currently have that allows the user to add some text when a checkbox is selected:
Code:
function HideComments()
{
var a1 = document.getElementById("crmForm_answer1").checked;
var a2 = document.getElementById("crmForm_answer2").checked;
var a3 = document.getElementById("crmForm_answer3").checked;
var a4 = document.getElementById("crmForm_answer4").checked;
var a5 = document.getElementById("crmForm_answer5").checked;
var a6 = document.getElementById("crmForm_answer6").checked;
var a7 = document.getElementById("crmForm_answer7").checked;
if(a1==true)
document.getElementById("crmForm_answer1_value").parentNode.parentNode.style.display = 'block';
else
document.getElementById("crmForm_answer1_value").parentNode.parentNode.style.display = 'none';
if(a2==true)
document.getElementById("crmForm_answer2_value").parentNode.parentNode.style.display = 'block';
else
document.getElementById("crmForm_answer2_value").parentNode.parentNode.style.display = 'none';
if(a3==true)
document.getElementById("crmForm_answer3_value").parentNode.parentNode.style.display = 'block';
else
document.getElementById("crmForm_answer3_value").parentNode.parentNode.style.display = 'none';
if(a4==true)
document.getElementById("crmForm_answer4_value").parentNode.parentNode.style.display = 'block';
else
document.getElementById("crmForm_answer4_value").parentNode.parentNode.style.display = 'none';
if(a5==true)
document.getElementById("crmForm_answer5_value").parentNode.parentNode.style.display = 'block';
else
document.getElementById("crmForm_answer5_value").parentNode.parentNode.style.display = 'none';
if(a6==true)
document.getElementById("crmForm_answer6_value").parentNode.parentNode.style.display = 'block';
else
document.getElementById("crmForm_answer6_value").parentNode.parentNode.style.display = 'none';
if(a7==true)
document.getElementById("crmForm_answer7_value").parentNode.parentNode.style.display = 'block';
else
document.getElementById("crmForm_answer7_value").parentNode.parentNode.style.display = 'none';
}
Thanks in advance,
Sam