Radio Button Component is loosing its selection

Hi All,

We encountered a challenge with the Radio Button Component. Under certain condition it is loosing or 'forgetting' the selected radio button.

We are using it to display the status in a workflow. Based on the users role and the status the entity is in, only certain options can be selected, so we are adjusting the choices.

Below is a code example what we are doing. As you might see, if you select option 3, it stays only a split second on the UI and then the selection disappears. And yes - we already
have submitted a support ticket to Appian, but it looks like the component will not be changed. 

Any suggestions how to overcome this? We have our own ideas, but would like to see first what the community will contribute.
(We will publish our version tomorrow).

Thanks

a!localVariables(
  local!selection:1,
  local!choices:a!refreshVariable(
    refreshAlways: true,
    value: if(
      local!selection = 3,
      {1,3},
      {1,2,3}
    )
  ),
  {
  a!radioButtonField(
    choiceValues: local!choices,
    choiceLabels: local!choices,
    value: local!selection,
    saveInto: {
      local!selection
    },
    
  ),
  a!textField(
    label: local!choices,
    value: local!selection
  ),
  }
 )
  

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    Interesting since it doesn't seem to affect the alternative case where you collapse the choices to make '3' go away when '2' is selected.

    My best guess is that the radio button's "filled" status in the UI is not refreshed after the choices collapse (perhaps Appian doesn't think it would need to refresh it again since the radio button itself is what caused the value update). 

    I also notice that if you edit the text box to save into local!selection, and type the value of 3 when the current selection is 1, it actually works as expected - in that case i'm guessing it's because appian evaluates the new selection value, reevaluates the new choices, then reevaluates the radio button field's status (correctly).

    a!localVariables(
      local!selection: 1,
      local!choices: a!refreshVariable(
        refreshAlways: true,
        value: if(
          local!selection = 3,
          {1,3},
          {1,2,3}
        )
      ),
      
      {
        a!radioButtonField(
          choiceValues: local!choices,
          choiceLabels: local!choices,
          value: local!selection,
          saveInto: {
            local!selection
          },
        ),
        a!textField(
          label: local!choices,
          value: local!selection,
          /* edited to add save-back ability here: */
          saveInto: a!save(local!selection, tointeger(save!value))
        )
      }
    )

Reply
  • +1
    Certified Lead Developer

    Interesting since it doesn't seem to affect the alternative case where you collapse the choices to make '3' go away when '2' is selected.

    My best guess is that the radio button's "filled" status in the UI is not refreshed after the choices collapse (perhaps Appian doesn't think it would need to refresh it again since the radio button itself is what caused the value update). 

    I also notice that if you edit the text box to save into local!selection, and type the value of 3 when the current selection is 1, it actually works as expected - in that case i'm guessing it's because appian evaluates the new selection value, reevaluates the new choices, then reevaluates the radio button field's status (correctly).

    a!localVariables(
      local!selection: 1,
      local!choices: a!refreshVariable(
        refreshAlways: true,
        value: if(
          local!selection = 3,
          {1,3},
          {1,2,3}
        )
      ),
      
      {
        a!radioButtonField(
          choiceValues: local!choices,
          choiceLabels: local!choices,
          value: local!selection,
          saveInto: {
            local!selection
          },
        ),
        a!textField(
          label: local!choices,
          value: local!selection,
          /* edited to add save-back ability here: */
          saveInto: a!save(local!selection, tointeger(save!value))
        )
      }
    )

Children
No Data