Page 1 of 1

Disable droplist (field2) input if a checkbox (field1) is checked

Posted: 2022-07-14 13:54
by csultan
Hi, I have a form with some fields in AppGini. Is any way to disable field2 input (droplist) if I check field1 (checkbox)?

Thank you.

Re: Disable droplist (field2) input if a checkbox (field1) is checked

Posted: 2022-07-15 19:26
by a.gneady
Try this code in hooks/tablename-dv.js (create that file if it doesn't exist:

Code: Select all

$j(() => {
    $j('#field1').on('click', function() {
        $j('#field2-container').select2($j(this).prop('checked') ? 'disable' : 'enable')
    })
})

Re: Disable droplist (field2) input if a checkbox (field1) is checked

Posted: 2022-07-16 05:15
by csultan
Great, it worked! Thank you very much for help!