D
Dilip
I am writing a WebControl that uses the status of a master check box
to determine if other dependent check boxes need to be checked/
unchecked. What is the best way to do it? I am not much of a web
programmer so apologies for the basic question.
Currently the way I see it being done is to generate individual
'javascript:' calls to a function on the master checkbox's onclick
handler, passing in the ID of the master and each dependent control
and flipping the latter based on the former. Is this the way to go?
IOW:
<....checkbox control HTML......
onclick="javascript:enableCB("master_ctrl","cb_1");enableCB("master_ctrl","cb_2") /
function enableCB(master, slave)
{
document.getElementById(slave).disabled = !
document.getElementById(master).checked;
document.getElementById(slave).parentNode.disabled = false; // I
don't even know why this is done :-(
}
to determine if other dependent check boxes need to be checked/
unchecked. What is the best way to do it? I am not much of a web
programmer so apologies for the basic question.
Currently the way I see it being done is to generate individual
'javascript:' calls to a function on the master checkbox's onclick
handler, passing in the ID of the master and each dependent control
and flipping the latter based on the former. Is this the way to go?
IOW:
<....checkbox control HTML......
onclick="javascript:enableCB("master_ctrl","cb_1");enableCB("master_ctrl","cb_2") /
function enableCB(master, slave)
{
document.getElementById(slave).disabled = !
document.getElementById(master).checked;
document.getElementById(slave).parentNode.disabled = false; // I
don't even know why this is done :-(
}