Change field to Required If Condition met

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Change field to Required If Condition met

Post by dharbitindy » 2022-01-20 18:40

Hello,

Does anyone know what the code is and where it should be placed to change a non-required field to required if a condition is met? For instance, If another field's value called Eff Percentage is less than let's say 95.0, then the Notes field would then become a required field in the Detail View?

Thanks much,
David

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1709
Joined: 2018-04-01 10:12

Re: Change field to Required If Condition met

Post by pbottcher » 2022-01-22 14:57

Hi,

you can add some code to the hooks/TABLENAME-dv.js file (create it if it does not exist)

Add something like

Code: Select all

if (CONDITION) {
    $j('#FIELDID').attr('required', true)}
}
This would make your field mandatory.

!! This will not alert you directly with a Popup message like AppGini does. This would need some extra code.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Re: Change field to Required If Condition met

Post by dharbitindy » 2022-01-23 04:08

As always, thank you sir! Very much appreciated.

I did change the .attr to .prop and the AppGini Popup message also showed up.

Thanks again,
David

Post Reply