Conditionally Grey out ChoiceLabels for Checkbox field

Hi,

Could anyone suggest how can we conditionally grey out only some of the choiceLabels for checkbox field while displaying all the choicelabels to the user.

 

thanks in advance

  Discussion posts and replies are publicly visible

Parents
  • Hi ,

    While I think has the best solution to use an editable grid, I took this as a bit of a challenge because I think it may be a use case I would have at some point.

    Below is some example code I put together to show this functionality. Putting this into a live application will take some additional work, but shows the idea you are attempting to implement.

    load(
    local!options: {
    "A",
    "B",
    "C",
    "D"
    },
    local!disabledOptions: {
    "A",
    "C"
    },
    local!values,
    {
    a!richTextDisplayField(
    label: "Disabled Check Boxes Example"
    ),
    a!forEach(
    items: local!options,
    expression: a!checkboxField(
    labelPosition: "COLLAPSED",
    choiceLabels: fv!item & if(
    length(
    wherecontains(
    fv!item,
    local!disabledOptions
    )
    ) = 0,
    {},
    " - Disabled"
    ),
    choiceValues: fv!item,
    disabled: wherecontains(
    fv!item,
    local!disabledOptions
    ),
    value: index(
    local!values,
    wherecontains(
    fv!item,
    local!values
    ),
    null
    ),
    saveInto: a!save(
    target: local!values,
    value: if(
    isnull(
    save!value
    ),
    remove(
    local!values,
    wherecontains(
    fv!item,
    local!values
    )
    ),
    append(
    local!values,
    save!value
    )
    )
    )
    )
    ),
    a!paragraphField(
    label: "Saved Values",
    value: local!values
    )
    }
    )
  • Hi bradc,

    This code is not working for my use case since the values in checkbox are coming dynamically everytime. Also i thought of creating 2 diff. checkboxes one for disabled options and other one for non-greyed out options ,but it is not working since eveytime different value will come.Please could you suggest me how should i proceed?

    thanks in advance

  • You should be able to replace local!options and local!disabledOptions with your appropriate values. Can you post your code?
  • I am unable to paste the code here but I have tried replacing them but it is not working.Is there any casting issue with them?

  • There may be several issues implementing my code into your application. It was meant as a POC, but you will likely need to rework it quite a bit to fit your application. Without seeing the full context of your use case, it will be very difficult to try to troubleshoot.
Reply Children
No Data