Radio Button not saving the value for page

A Score Level 1

a!localVariables(
  local!isChanged:a!refreshVariable(
    value: ri!isChangesMade,
    refreshOnReferencedVarChange: false),
  
  a!formLayout(
    
    contents:{
      a!buttonLayout(
        accessibilityText: "Select a Type of Service",
        secondaryButtons:{

                  
                },
                
              )
            }
          )
        }
      ),
     
      a!radioButtonField(
        label:"Do you want to make changes to any services?",
        choiceLabels:{"No","Yes"},
        choiceValues:{false,true},
        value:local!isChanged,
        saveInto:local!isChanged,
        
        
      ),
      if(
        local!isChanged,
        rule!SS_ui_serviceGrid(
 ),
        {}
      ),

      
    },
    
  )
)
The Interface has different services listed at the top of the form. If I select one service, select 'Yes' for radio buttons, and make changes to the grid and go to other services. when I come back to the previous service, the changes are not getting saved. I tried using the refresh variable but it is not working. Any suggestions to resolve this issue.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Assuming that the "service" you change is modified inside "rule!SS_ui_serviceGrid", where and how does this component save or store that modified data? And what do you mean with "the changes are not getting saved"?

  • 0
    A Score Level 1
    in reply to Stefan Helzle

    Yes, it's not saving the radio button value when the service is changed. It always refreshes to the default value 'NO'.

  • 0
    Certified Senior Developer
    in reply to Tan18
    value when the service is changed

    can you elaborate? what is a "service" for you?

  • 0
    Certified Lead Developer
    in reply to Tan18

    You need to provide more context - what do you mean when you say things like "select one service... come back to the previous service"?  If you're referring to different site dashboards, for instance, then there's no reason to expect anything other than the default values loading every time the interface is loaded.

  • I am facing a similar issue. have u been able to resolve??

  • 0
    Certified Lead Developer

    Constant Vigilance, folks!  Double-check fishy comments and report as spam!

  • 0
    Certified Lead Developer
    in reply to Sai Manam

    What exactly are you having a hard time with?  This original post is fairly old and the poster never really clarified exactly what they were trying to do / when / why.

  • here is code part.


    a!localVariables(
      local!var1: {
        'type!{urn:com:appian:types:TST}TST_CDT'(
          field1: null(),
          field2: null(),
          field3: null(),
          field4: ri!inputId
        ),
        'type!{urn:com:appian:types:TST}TST_CDT'(
          field1: null(),
          field2: null(),
          field3: null(),
          field4: ri!inputId
        ),
        'type!{urn:com:appian:types:TST}TST_CDT'(
          field1: null(),
          field2: null(),
          field3: null(),
          field4: ri!inputId
        ),
        'type!{urn:com:appian:types:TST}TST_CDT'(
          field1: null(),
          field2: null(),
          field3: null(),
          field4: ri!inputId
        ),
        'type!{urn:com:appian:types:TST}TST_CDT'(
          field1: null(),
          field2: null(),
          field3: null(),
          field4: ri!inputId
        )
      },
      local!var1Count: count(local!var1),
      a!formLayout(
        label: "Input",
        contents: {
          a!gridLayout(
            totalCount: local!var1Count,
            headerCells: {
              a!gridLayoutHeaderCell(label: "Col1"),
              a!gridLayoutHeaderCell(label: "Col2"),
              a!gridLayoutHeaderCell(
                label: "Col3",
                align: "RIGHT"
              ),
              /* For the "Remove" column */
              a!gridLayoutHeaderCell(label: "")
            },
            columnConfigs: {
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
              a!gridLayoutColumnConfig(width: "ICON")
            },
            rows: a!forEach(
              items: local!var1,
              expression: a!gridRowLayout(
                id: fv!index,
                contents: {
                  a!textField(
                    label: "Col1",
                    placeholder: dollar(0.00, 2),
                    value: if(
                      isnull(
                        fv!item.field1
                      ),
                      null(),
                      dollar(
                        fv!item.field1,
                        2
                      )
                    ),
                    saveInto: {
                      a!save(
                        fv!item.field1,
                        cleanwith(save!value, ".0123456789")
                      ),
                      a!save(
                        fv!item.field1,
                        cleanwith(save!value, ".0123456789")
                      )
                    },
                    required: true
                  ),
                  a!textField(
                    label: "col2",
                    placeholder: text(0, "0.00") & "%",
                    value: if(
                      isnull(
                        fv!item.field2
                      ),
                      null(),
                      fv!item.field2 & "%"
                    ),
                    saveInto: {
                      fv!item.field2
                     },
                    required: true
                  ),
                  a!textField(
                    label: "Col3",
                    placeholder: text(0, "0.00") & "%",
                    value: if(
                      isnull(
                        fv!item.field2
                      ),
                      null(),
                      fv!item.field2 & "%"
                    ),
                    saveInto: {
                      fv!item.field2
                    },
                    required: true
                  ),
    
                  /* For the Removal Column*/
                  a!richTextDisplayField(
                    value: a!richTextIcon(
                      icon: "close",
                      altText: "delete " & fv!index,
                      caption: "Remove " & fv!item.field2 & " " & fv!item.field3,
                      link: a!dynamicLink(
                        value: fv!index,
                        saveInto: {
                          a!save(
                            local!var1,
                            remove(local!var1, save!value)
                          )
                        }
                      ),
                      linkStyle: "STANDALONE",
                      color: "NEGATIVE"
                    )
                  )
                }
              )
            ),
            addRowlink: a!dynamicLink(
              label: "Add row",
              value: {
                'type!{urn:com:appian:types:TST}TST_CDT'()
              },
              saveInto: {
                a!save(
                  local!var1,
                  append(local!var1, save!value)
                )
              }
            ),
            rowHeader: 1
          ),
          a!radioButtonField(
            label: "Options",
            choiceLabels: {
              "Option 1",
              "Option 2"
            },
            choiceValues: { 1, 2 },
            value: if(
              ri!isOption1 = true,
              1,
              if(ri!isOption2 = true, 2, null)
            ),
            saveInto: {
              a!save(
                ri!isOption1,
                if(save!value = 1, true, false)
              ),
              a!save(
                ri!isOption2,
                if(save!value = 2, true, false)
              )
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: a!buttonWidget(
            label: "Submit",
            saveInto: {
              a!save(ri!isSubmit, true()),
              a!forEach(
                local!var1,
                a!save(
                  fv!item.isOption1,
                  ri!isOption1
                )
              ),
              a!forEach(
                local!var1,
                a!save(
                  fv!item.isOption2,
                  ri!isOption2
                )
              ),
              a!save(
                ri!var1Data,
                local!var1
              )
            },
            submit: true,
            style: "PRIMARY"
          ),
          secondaryButtons: a!buttonWidget(
            label: "CANCEL",
            saveInto: ri!isSubmit,
            submit: true,
            style: "SECONDARY",
            validate: false
          )
        )
      )
    )