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

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

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

  • 0
    Certified Lead Developer
    in reply to Sai Manam

    Thanks for the code snippet, though i'm unclear what your issue is -- Can you please describe BOTH:

    • what you were intending for this to do
    • what it is ACTUALLY doing - i.e. what its behavior is failing to accomplish?
  • 0
    Certified Lead Developer
    in reply to Sai Manam

    Further, when asking for help with respect to a particular component, it's usually most helpful if you develop a stand-alone interface code snippet that would reproduce your issue, particularly since you would then be able to post a handful of lines of code instead of hundreds, and additionally since then we'd be able to help you by simply copy-and-pasting into a blank interface editor.  I've prepared such an example, which seems to work for me:

    a!localVariables(
      local!isOption1: null(),
      local!isOption2: null(),
      
      a!radioButtonField(
        label: "Options",
        choiceLabels: {
          "Option 1",
          "Option 2"
        },
        choiceValues: { 1, 2 },
        value: if(
          local!isOption1,
          1,
          if(local!isOption2, 2, null)
        ),
        saveInto: {
          a!save(
            local!isOption1,
            if(save!value = 1, true, false)
          ),
          a!save(
            local!isOption2,
            if(save!value = 2, true, false)
          )
        }
      )
    )

  • Hello Mike, 

    for some reason I am blocked from commenting earlier. Let me give some context and explain the issue I am facing.

    I am trying to create a form with an editable grid and a Radio button field.

    UI would look like this

    attached is the behavior.

  • 0
    Certified Lead Developer
    in reply to Sai Manam

    It's hard to guess what's happening wrong here just based on your animated graphic (though i'd love to hear what tool you used to create that, i actually don't have such a tool at my disposal).  The best I can guess is that your radio button's saveInto is not executing properly. 

    When you select a value for it, does the expected Rule Input variable get the expected value change in the Rule Inputs panel?  That's the first thing to check, and next steps depend on the answer to that.

  • 0
    Certified Senior Developer
    in reply to Sai Manam

    It looks like Mapping issue. if using PM, please check whether you mapped the data with the correct variable. Alsoo, please check the mapping on the saveinto's as well. If need more help, Please share the code snippet for this interface.

  • Attaching standalone code.

    a!localVariables(
      local!var1: {
        a!map(col1: null, col2: null, col3: null),
        a!map(col1: null, col2: null, col3: null),
      },
      local!isOption1: false,
      local!isOption2: false,
      local!isSubmit: false,
      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"),
              /* 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.col1
                      ),
                      null(),
                      dollar(
                        fv!item.col1,
                        2
                      )
                    ),
                    saveInto: {
                      a!save(
                        fv!item.col1,
                        cleanwith(save!value, ".0123456789")
                      ),
                      a!save(
                        fv!item.col1,
                        cleanwith(save!value, ".0123456789")
                      )
                    },
                    required: true
                  ),
                  a!textField(
                    label: "col2",
                    placeholder: text(0, "0.00") & "%",
                    value: if(
                      isnull(
                        fv!item.col2
                      ),
                      null(),
                      fv!item.col2 & "%"
                    ),
                    saveInto: {
                      fv!item.col2
                    },
                    required: true
                  ),
                  a!dateField(
                    label: "col3",
                    value: fv!item.col3,
                    saveInto: fv!item.col3,
                    required: true,
                    align: "RIGHT",
                    validations: {
                      if(
                        and(
                          year(
                            rule!APN_replaceNull(
                              nullableValue: fv!item.col3,
                              replacementValue: now()
                            )
                          ) <> year(now())
                        ),
                        "Paycheck date must be in the current year for Missing Earnings option.",
                        {}
                      )
                    }
                  ),
                  /* For the Removal Column*/
                  a!richTextDisplayField(
                    value: a!richTextIcon(
                      icon: "close",
                      altText: "delete " & fv!index,
                      caption: "Remove " & fv!item.col2 & " " & 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: {
                a!map(col1: null, col2: null, col3: null)
              },
              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(
              local!isOption1 = true,
              1,
              if(local!isOption2 = true, 2, null)
            ),
            saveInto: {
              a!forEach(
                local!var1,
                a!save(
                  fv!item.isOption1,
                  if(save!value = 1, true, false)
                )
              ),
              a!forEach(
                local!var1,
                a!save(
                  fv!item.isOption2,
                  if(save!value = 2, true, false)
                )
              )
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: a!buttonWidget(
            label: "Submit",
            saveInto: {
              a!save(local!isSubmit, true()),
              a!forEach(
                local!var1,
                a!save(
                  fv!item.isOption1,
                  local!isOption1
                )
              ),
              a!forEach(
                local!var1,
                a!save(
                  fv!item.isOption2,
                  local!isOption2
                )
              )
            },
            submit: true,
            style: "PRIMARY"
          ),
          secondaryButtons: a!buttonWidget(
            label: "CANCEL",
            saveInto: local!isSubmit,
            submit: true,
            style: "SECONDARY",
            validate: false
          )
        )
      )
    )


  • I found solution to this by adding below part to saveInto. thank you guys. Tool is used is snagit

    a!save(
    local!isOption1,
    if(save!value = 1, true, false)
    ),
    a!save(
    local!isOption2,
    if(save!value = 2, true, false)
    ),

Reply Children
No Data