Skip to main content
August 2, 2022
Question

Radio Button not saving the value for page

  • August 2, 2022
  • 18 replies
  • 0 views

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.

    18 replies

    August 2, 2022
    [deleted]
    mikes0011
    Brainy
    September 20, 2022

    The Expression Guru
    stefanhelzle0001
    Brainy
    August 3, 2022

    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"?

    August 3, 2022

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

    richardm900458
    August 3, 2022
    value when the service is changed

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

    saitejam0003
    September 20, 2022

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

    mikes0011
    Brainy
    September 20, 2022

    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.

    The Expression Guru
    September 20, 2022

    For some reason saitejam003 is blocked from commenting. 

    here is a version of the code he is working on:

    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
          )
        )
      )
    )

    mikes0011
    Brainy
    September 20, 2022

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

    The Expression Guru