set a checkbox field as readonly for those who do not belong to the admin group
Posted: 2019-10-06 12:21
Hi!
I would like to set a checkbox field (named autorizza_attestato) as readonly for those who do not belong to the admin group.
I used this code in the hook file of my table partecipazione_evento_pubblico but it does not work.
function partecipazione_evento_pubblico_dv($selectedID, $memberInfo, &$html, &$args){
<?php
$form_code = ob_get_contents();
ob_end_clean();
$html .= $form_code;
if(!in_array($memberInfo['group'], ['Admins'])) {
ob_start();
?>
<script>
$j(function() {
$j('#autorizza_attestato').prop('readonly', true);
})
</script>
<?php
$html .= ob_get_clean();
}
}
Any help please?
Thank you!
Fabiano
I would like to set a checkbox field (named autorizza_attestato) as readonly for those who do not belong to the admin group.
I used this code in the hook file of my table partecipazione_evento_pubblico but it does not work.
function partecipazione_evento_pubblico_dv($selectedID, $memberInfo, &$html, &$args){
<?php
$form_code = ob_get_contents();
ob_end_clean();
$html .= $form_code;
if(!in_array($memberInfo['group'], ['Admins'])) {
ob_start();
?>
<script>
$j(function() {
$j('#autorizza_attestato').prop('readonly', true);
})
</script>
<?php
$html .= ob_get_clean();
}
}
Any help please?
Thank you!
Fabiano