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

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
csultan
Posts: 9
Joined: 2020-02-09 19:40

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

Post by csultan » 2022-07-14 13:54

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.

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

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

Post by a.gneady » 2022-07-15 19:26

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')
    })
})
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

User avatar
csultan
Posts: 9
Joined: 2020-02-09 19:40

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

Post by csultan » 2022-07-16 05:15

Great, it worked! Thank you very much for help!

Post Reply