Need checkboxField to deselect options when certain options are selected.

I have an ask to make a checkbox field have the following logic. 

Checkbox has four items. If option ITEM 1 is selected then selection of ITEM 2, ITEM 3, ITEM 4 should be deselected automatically.

If options ITEM 2, ITEM 3, ITEM 4 are selected then option ITEM 1 should be deselected automatically.

Below code tracks the current values for the checkbox field in local!setA, previous values in local!setB, and the difference between the two sets which indicates what object the user just clicked in local!setDIFF.

The issue we are encountering is that when the deselection logic is triggered, I can see local!setA's value meets the requirement but the checkboxField UI doesn't. It still shows the options as selected when they have been removed from local!setA. User has to make another mouse click action like clicking around the page then the UI reflects the local!setA values.

Has anyone experienced a similar issue with checkboxField and were able to have the checkbox options refresh to match the local value?

a!localVariables(
  local!setA:null,
  local!setB:null,
  local!setDIFF:null,
  a!checkboxField(
    align:"LEFT",
    labelPosition:"COLLAPSED",
    choiceLayout:"COMPACT",
    choiceLabels:{"ITEM 1","ITEM 2","ITEM 3","ITEM 4"},
    choiceValues:{"ITEM 1","ITEM 2","ITEM 3","ITEM 4"},
    value: local!setA,
    saveInto: {
      a!save(local!setB,local!setA),
      a!save(local!setDIFF,difference(save!value,local!setB)),
      a!save(local!setA,
      if(
        contains(local!setDIFF,"ITEM 1"),
        {"ITEM 1"},
        difference(save!value,{"ITEM 1"}),
      )
      )
    }
  )
)

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Ok gotcha - the main thing I wanted to get at here is that the example provided below might provide the functionality you're looking for, but it also has the potential to be confusing. Personally I would find it confusing if certain options are conditionally selected or not selected, so sometimes it can be easier to split into multiple sets of checkboxes to ensure users fully understand the options.