Checkboxfield on user interface

a!localVariables(
  local!additionalInfoRequired,
  local!cancelled,
  a!formLayout(
    contents:{
      a!checkboxField(
        labelPosition: "ABOVE",
        choiceLabels: {"additional Info Required"},
        choiceValues: {true},
        value: if(local!additionalInfoRequired, true, null),
        saveInto: a!save(
          local!additionalInfoRequired,
          if(isnull(save!value), false, true),
          a!save(local!cancelled,false)
        ),
      ),
      a!checkboxField(
        labelPosition: "ABOVE",
        choiceLabels: {"additional Info Required"},
        choiceValues: {true},
        value: if(local!cancelled, true, null),
        saveInto: a!save(
          local!cancelled,
          if(isnull(save!value), false, true)
        ),
      )
    },
    buttons:a!buttonLayout(
      primaryButtons:{
        a!buttonWidget(
          label:"Submit",
          submit: true
        )
      }
    )
  )
)

Hi,

My requirement is when I check one checkbox, another checkbox should uncheck(If checked already).

This functionality I am able to achieve with the attached code.

But, I am encountering an issue like, I was unable to "uncheck" the same selected checkbox.

If I remove the code line number 14 (a!save(local!cancelled,false)), then I am unable to fulfill my requirement.

If I use this line, then I am unable to uncheck the same checkbox which I selected.

Any advice, please.

Thanks.

  Discussion posts and replies are publicly visible

Parents
  • a!localVariables(
      local!additionalInfoRequired,
      local!cancelled,
      a!formLayout(
        contents: {
          a!checkboxField(
            labelPosition: "ABOVE",
            choiceLabels: { "additional Info Required" },
            choiceValues: { true },
            value: if(
              local!cancelled,
              null,
              local!additionalInfoRequired
            ),
            saveInto: {
              a!save(
                local!additionalInfoRequired,
                if(local!additionalInfoRequired, null, true)
              ),
              a!save(
                local!cancelled,
                if(local!cancelled, false, null)
              )
            }
          ),
          a!checkboxField(
            labelPosition: "ABOVE",
            choiceLabels: { "additional Info Required" },
            choiceValues: { true },
            value: if(
              local!additionalInfoRequired,
              null,
              local!cancelled
            ),
            saveInto: {
              a!save(
                local!cancelled,
                if(local!cancelled, null, true)
              ),
              a!save(
                local!additionalInfoRequired,
                if(local!additionalInfoRequired, false, null)
              )
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(label: "Submit", submit: true)
          }
        )
      )
    )

    My previous replies were marked as spams for a reason.. Nevermind.

    I'm posting again the fixed version with the variables you had in your code.

Reply
  • a!localVariables(
      local!additionalInfoRequired,
      local!cancelled,
      a!formLayout(
        contents: {
          a!checkboxField(
            labelPosition: "ABOVE",
            choiceLabels: { "additional Info Required" },
            choiceValues: { true },
            value: if(
              local!cancelled,
              null,
              local!additionalInfoRequired
            ),
            saveInto: {
              a!save(
                local!additionalInfoRequired,
                if(local!additionalInfoRequired, null, true)
              ),
              a!save(
                local!cancelled,
                if(local!cancelled, false, null)
              )
            }
          ),
          a!checkboxField(
            labelPosition: "ABOVE",
            choiceLabels: { "additional Info Required" },
            choiceValues: { true },
            value: if(
              local!additionalInfoRequired,
              null,
              local!cancelled
            ),
            saveInto: {
              a!save(
                local!cancelled,
                if(local!cancelled, null, true)
              ),
              a!save(
                local!additionalInfoRequired,
                if(local!additionalInfoRequired, false, null)
              )
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(label: "Submit", submit: true)
          }
        )
      )
    )

    My previous replies were marked as spams for a reason.. Nevermind.

    I'm posting again the fixed version with the variables you had in your code.

Children
No Data