Page 1 of 1

input type checkbox on disable attribute

Posted: 2020-11-25 06:57
by Leving Tinoco
juts a suggestion for the input type checkbox went the table in read-only (not editable).

Instead of using the attribute "disabled", it would be better to use a function attribute like "$j(':checkbox').attr('onclick', 'return false;');"

The problem I see is that when in read-only mode in details view, it is very difficult to see the checkbox. using return false; with onclick will be visible but not editable.

I add it some code to my project to force this.

to my table.php on hook folder I add

Code: Select all

if (!$table_perms['insert']) {
$html .= "<script>\n"
                . " \$j('[name=myform]').append('<input name=\"ReadOnly\" value=1 type=\"hidden\">');\n"
                . "</script>";
};
and table-dv.js

Code: Select all

var readOnly = $j('[name=readOnly]').val();

    if (readOnly)
    {
        $j(':checkbox').prop('disabled', false);
        $j(':checkbox').attr('onclick', 'return false;');
    }
thanks