The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
Show Fields only if checkbox selected - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: Show Fields only if checkbox selected (/showthread.php?tid=2356) |
Show Fields only if checkbox selected - Cubitus - Jan 25th, 2013 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 RE: Show Fields only if checkbox selected - Aryl - Feb 6th, 2013 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" |