There is certain issue with the cascading of the radio button component. T

There is certain issue with the cascading of the radio button component.
The scenario which doest work is :
1) We have two SAIL components, drop down and radio button, the value of the radio button depend on the dropdown selected.
2) Radio button gets the value initially when we select the drop down field.
3) But now when we choose the radio button and than select the dropdown the radio button doesnt reflect the change.

Note: if we replace the radio button with the checkbox the changes are reflected

I have attached the code for better understanding

RadioButtonIssue.txt

OriginalPostID-199350

OriginalPostID-199350

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Firstly there are some errors in your attachment with the label for the radio button which confuses your debugging.
    What you're experiencing with the radio button is standard design and inherent to browsers. The basic rule of thumb is that if you want to de-select a radio button it should be a checkbox.
  • Hi Nilesh, You have invalid statement in your code
    label:"Selected Radio Button" & "Value":local!radioButtonFieldValue
    If you replaced it with
    label:"Selected Radio Button" & "Value"&local!radioButtonFieldValue,
    The value will reflected back. So the code for radio button will be
    a!radioButtonField(
    label:"Selected Radio Button" & "Value"&local!radioButtonFieldValue,
    choiceLabels:{"Yes","No"},
    choiceValues:{"Yes","No"},
    value:if(rule!APN_isBlank(
    local!radioButtonFieldValue),null,local!radioButtonFieldValue),
    saveInto:local!radioButtonFieldValue
    )
  • =load(
    local!dropDownFieldValue:null,
    local!radioButtonFieldValue:"No",

    a!formLayout(
    label: "Lorem Ipsum",
    instructions: "Lorem Ipsum",
    firstColumnContents: {


    a!dropdownField(
    label:"Select the dropdown field",
    placeholderLabel:"Please select",
    choiceLabels:{"A","B","C"},
    choiceValues:{"A","B","C"},
    value:local!dropDownFieldValue,
    saveInto:{local!dropDownFieldValue,
    a!save(local!radioButtonFieldValue,null)
    }
    )
    ,
    a!radioButtonField(
    label:"Selected Radio Button",
    choiceLabels:{"Yes","No"},
    choiceValues:{"Yes","No"},
    value:if(rule!APN_isEmpty(
    local!radioButtonFieldValue),null,local!radioButtonFieldValue),
    saveInto:local!radioButtonFieldValue
    )

    },

    secondColumnContents: {
    /* Add components here for a two-column form */
    },
    buttons: a!buttonLayout(
    primaryButtons: {
    a!buttonWidgetSubmit(
    label: "Submit",
    style: "PRIMARY",
    saveInto: {}
    )
    },
    secondaryButtons: {
    a!buttonWidgetSubmit(
    label: "Cancel",
    style: "NORMAL",
    value: true,
    saveInto: ri!cancel,
    skipValidation: true
    )
    }
    ),
    validations: {}
    )


    )

    There was type error, but the issue still persist.
    Initially the value for Radio Button is "NO", now when i select the Drop Down the value of radioButton is cleared to null but the same is not getting reflected on UI
  • I have configured the value of radioButton to null in saveInto of dropdown filed,when the user selects any value from the dropdown the radioButton value gets reset to null, but the same does not get reflected on the radioButton Component.

    This issue is with storing of null value for radioButton, but if we save one of the value from the choiceValues,we dont face the issue
  • Its not a standard practice to use checkbox , for the field that has only one answer.
    It should be radio button as per our requirement.
  • Hi Nilesh,

    Try using rule input variable for radiobutton instead of a local variable. Like the below code snippet.

    a!radioButtonField(
    label: "Selected Radio Button",
                        placeholderLabel: "Please select",
    choiceLabels: {
    "Yes",
    "No"
    },
    choiceValues: {
    "Yes",
    "No"
    },
    value: if(isnull(ri!radioButtonFieldValue),null,ri!radioButtonFieldValue),
    saveInto: ri!radioButtonFieldValue
    )
              
    Give it a try using ri!radioButtonFieldValue. It may run fine probably.

    And to prepopulate the value of radiobutton to "No", you can always do that by passing a default value from outside the form for radiobutton.
  • We initially tried with rule input only, that dint workout as well
  • The issue is with the null value only, if we save the null value of the radio button through some other component than it doesn't gets refreshed on UI.
  • AS a fix we tried to put the radioButton component in the if statement,
    Something like below
    if(isnull(local!radioButtonFieldValue),a!radioButtonField(
    label:"Selected Radio Button",
    choiceLabels:{"Yes","No"},
    choiceValues:{"Yes","No"},
    value:local!radioButtonFieldValue,
    saveInto:local!radioButtonFieldValue
    ),a!radioButtonField(
    label:"Selected Radio Button",
    choiceLabels:{"Yes","No"},
    choiceValues:{"Yes","No"},
    value:local!radioButtonFieldValue,
    saveInto:local!radioButtonFieldValue
    ))
    But its just a workaround, we need better solution for this issue