Skip to main content
venkataharishd0002
Inspiring
Dec 22, 2021 8:35 PM UTC
Question

Disable Checkboxes based on Condition

Lets consider I'm having two sites X and Y. Based on my selection of site the following check boxes should enable/Greyout.

Initially all should unchecked as shown in the below snippet.

If i select the Site X then A and C should enable (i can Check A or C or both) to check and B should be greyout.

If i select the Site Y then A and B should enable (i can Check A or B or both) to check and C should be Greyout.

Could you please help me with some sample code.

Note: Site will be passed through a ri variable.

Thanks.

    7 replies

    stefanhelzle0001
    Brainy
    Dec 22, 2021 8:53 PM UTC

    Hm ... individual options cannot be disabled. Is this a must?

    venkataharishd0002
    Inspiring
    Dec 22, 2021 8:57 PM UTC

    Yes, it’s must..it is ok if it possible with 3 checkbox fields

    mikes0011
    Brainy
    Dec 22, 2021 9:01 PM UTC

    In the vanilla a!checkboxField(), you can't enable/disable individual items inherently.  Depending on the severity of your use case, there are a few different possible workarounds, though they can be quite a bit more of a pain to implement.  One of these is to stack a few different checkboxFields each having one checkbox; another option is to have a selectable grid where you control the checkbox availability on a row-by-row basis.

    The Expression Guru
    venkataharishd0002
    Inspiring
    Dec 23, 2021 6:40 AM UTC

    I want go with the first option : One of these is to stack a few different checkboxFields each having one checkbox

    If possible just help me with some sample code So that i can get more clarity on this.

    mikes0011
    Brainy
    Dec 23, 2021 2:31 PM UTC

    Some past threads actually have workable code samples for this.  Check out the linked thread, though if you have further questions I suggest replying again to this one instead of reviving the old one.

    BTW, usually i suggest searching different combinations of phrases in the community search bar as sometimes these old threads won't match the first thing you try.

    The Expression Guru
    Inspiring
    Aug 1, 2022 3:52 AM UTC

    You can create a decision table and configure the expected out from the inputs and use that rule to show those values only based on condition instead of disabling it.