Defaulted checkboxes

Hi All

Just curious if anyone has come across a situation where, based on what is selected in a dropdown field, certain checkboxes would appear already ticked and with the value/s stored in an ri? I was able to have the default values selected based on a selected item in the dropdown field, but the value/s would not save to the ri.

Thanks in advance.

OriginalPostID-231989

  Discussion posts and replies are publicly visible

  • Hi ryant122,

    It is auto selected values,so you can do one thing for this..first you can save those values local! and in the button submit u can save the local! values in ri!...
    it will work.
  • As mentioned try below code.
    Note: rule input is multiple text values

    load(
    local!test,
    a!sectionLayout(
    label: "",
    firstColumnContents: {
    a!dropdownField(
    label: "Dropdown1",
    labelPosition: "ABOVE",
    choiceLabels:{"value1","Value2"},
    placeholderLabel:"---Select a Value---",
    choiceValues:{"value1","Value2"},
    value:local!test,
    saveInto: {local!test,
    a!save(ri!checkBoxValues,local!test)
    },
    refreshAfter: "UNFOCUS",
    validations: {}
    ),
    a!checkboxField(
    label: "Checkbox",
    labelPosition: "ABOVE",
    choiceLabels:{"value1","Value2"},
    choiceValues:{"value1","Value2"},
    value:local!test,
    saveInto: {ri!checkBoxValues},
    refreshAfter: "UNFOCUS",
    validations: {}
    ) },
    secondColumnContents: {
    },
    validations: {}
    )
    )
  • @ryant There isn't really a necessity for local variables for saving the value of the component in this case(as mentioned in the first comment) as it results in duplication of variables(one local and one rule input variable for each component) and it also additional logic for saving the values from local variables to rule inputs in the same or other SAIL component.

    It might be worth opting for local variables in the case of choiceLabels, choiceValues and rule input variables for saving the value associated with a component. This way, Save Changes also works even if the User changes the default values associated with a SAIL component and moves out of the form by clicking 'Save Changes'.