I can disable the checkboxes but I can't make them read only.
I am able to do this, so I know it works:
<SCRIPT LANGUAGE="JavaScript">
function disableform(staff_access_a
llowed_add
_recordcou
nt) {
for (i = 0; i <= staff_access_allowed_add_r
ecordcount
; i++) {
document.updatestaff.dmhfa
cil[i].dis
abled = true;
}
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function enableform(staff_access_al
lowed_add_
recordcoun
t) {
for (i = 0; i <= staff_access_allowed_add_r
ecordcount
; i++) {
document.updatestaff.dmhfa
cil[i].dis
abled = true;
}
}
</SCRIPT>
BUT I AM UNABLE TO DO THIS:
<SCRIPT LANGUAGE="JavaScript">
function disableform(staff_access_a
llowed_add
_recordcou
nt) {
for (i = 0; i <= staff_access_allowed_add_r
ecordcount
; i++) {
document.updatestaff.dmhfa
cil[i].rea
dOnly = true;
document.updatestaff.dmhfa
cil[i].sty
le.backgro
undColor="
#CCCCCC";
document.updatestaff.dmhfa
cil[i].sty
le.color="
#FF0000"
}
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function enableform(staff_access_al
lowed_add_
recordcoun
t) {
for (i = 0; i <= staff_access_allowed_add_r
ecordcount
; i++) {
document.updatestaff.dmhfa
cil[i].rea
dOnly = false;
document.updatestaff.dmhfa
cil[i].sty
le.backgro
undColor="
#FFFFFF";
document.updatestaff.dmhfa
cil[i].sty
le.color="
#000000"
}
}
</SCRIPT>
This is the CF that calls the Javascript:
<cfinput type="radio" name="disable_enable_radio
" onclick= "enableform(#staff_access_
allowed_ad
d.recordco
unt#); return true;"
value = "Enable" checked = "#disdte_is_null#"><b>Enab
le</b>
</td>
<td>
<cfinput type="radio" name="disable_enable_radio
" onclick="disableform(#staf
f_access_a
llowed_add
.recordcou
nt#); return true;"
value = "Disable" checked = "#disdte_not_null#"><b>Dis
able</b>
</td>
THis is the cfquery that gets the recordcount:
<cfquery datasource="clinical" name="staff_access_allowed
_add" >
SELECT distinct dmhfacil, (select dmhfacil from staff_access b where code =
'#updatecode#' and b.dmhfacil = staff_access.dmhfacil) was_it_selected
from staff_access
where dmhfacil in (select dmhfacil from staff_access where
code = '#URL.entryStaffcode#')
</cfquery>
Start Free Trial