Posts: 1
Threads: 1
Joined: Jan 2013
Reputation:
0
Hello everyone,
is it possible to show one or more fields in a form only if a checkbox is activated?
Thanks in advance for your help.
Cubitus
Posts: 4
Threads: 1
Joined: Feb 2013
Reputation:
0
You can do this with javascript using a function like:
function RBtnCk(info) {
var N = info.name;
var YN = info.value; // alert(N+' : '+YN);
var show = 'none';
if (YN == 'No') { show = 'block';
document.getElementById(N+'Text').style.display = show;
}
}
then calling it from your radio button with:
onclick="RBtnCk(this)"
and assign the same id+Text to it as the radio button. Example:
radio button code: input name="r1" type="radio" value="No" onclick="RBtnCk(this)"
hidden area code: table id="r1Text" style="display:none"