Also if you want the value entered to be cleared once they are unchecked
then add this
function fncEnable(chknum)
{
if(document.frm["chk"+chkn
{
document.frm["txt"+chknum]
document.frm["txtarea"+chk
}
else
{
document.frm["txt"+chknum]
document.frm["txtarea"+chk
document.frm["txt"+chknum]
document.frm["txtarea"+chk
}
}
in CF you will have to submit the form everytime to the same page when the checkbox is checked or unchecked and then put cfif conditions around the text box and textarea...
let me know if you want just the CF solution
Regards
Hart
Main Topics
Browse All Topics





by: hartPosted on 2004-11-29 at 01:22:57ID: 12694342
this can be done with javascript... it can also be done through CF but then the page will refresh everytime u click on the checkbox which wouldn't be that gr8
um].checke d == true) .disabled = false; num].disab led = false; .disabled = true; num].disab led = true;
-------------------- javascript solution ----------------------
<html>
<head>
<title>Enable / Disable</title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function fncEnable(chknum)
{
if(document.frm["chk"+chkn
{
document.frm["txt"+chknum]
document.frm["txtarea"+chk
}
else
{
document.frm["txt"+chknum]
document.frm["txtarea"+chk
}
}
//-->
</SCRIPT>
</head>
<body>
<form name="frm" method="post" action="somepage name">
<input type="checkbox" name="chk1" value="1" OnClick="fncEnable(1)">
<input type="text" name="txt1" value="" DISABLED>
<textarea rows="10" cols="10" name="txtarea1" disabled></textarea>
</form>
</body>
</html>
PS: in a loop form the check boxes with names as chk1, chk2, chk3 etc... and the corresponding text box and textarea names will also have 2,3,4 appended to it.. and in the function just send the number...
Regards
Hart