Disable button.

I have 3 buttons and two buttons must to be disabled if I select one of the 3 butttons.

I tried with the follow code on disabled property:

a!buttonArrayLayout(
     buttons: {
          a!buttonWidget(
               icon: "check",
               size: "LARGE",
               value: local!buttonVal = 2,
               style: "DESTRUCTIVE",
               disabled: if(local!buttonselected = true, if(local!buttonVal = 1, "SECONDARY", false), false),
               submit: a!save(local!buttonselected, true)
)
},
      align: "CENTER"
)

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Senior Developer

    a!localVariables(
      local!btnSelected,
      {
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              icon: "check",
              size: "LARGE",
              style: "DESTRUCTIVE",
              saveInto: { a!save(local!btnSelected, 1) },
              disabled: contains({ 2, 3 }, tointeger(local!btnSelected))
            ),
            a!buttonWidget(
              icon: "check",
              size: "LARGE",
              style: "DESTRUCTIVE",
              saveInto: { a!save(local!btnSelected, 2) },
              disabled: contains({ 1, 3 }, tointeger(local!btnSelected))
            ),
            a!buttonWidget(
              icon: "check",
              size: "LARGE",
              style: "DESTRUCTIVE",
              saveInto: { a!save(local!btnSelected, 3) },
              disabled: contains({ 2, 1 }, tointeger(local!btnSelected))
            )
          },
          align: "CENTER"
        )
      }
    )

    Please try this code. I save the value for each button as 1,2 and 3 and according to these values i set the disability logic for the buttons.

Reply
  • +1
    Certified Senior Developer

    a!localVariables(
      local!btnSelected,
      {
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              icon: "check",
              size: "LARGE",
              style: "DESTRUCTIVE",
              saveInto: { a!save(local!btnSelected, 1) },
              disabled: contains({ 2, 3 }, tointeger(local!btnSelected))
            ),
            a!buttonWidget(
              icon: "check",
              size: "LARGE",
              style: "DESTRUCTIVE",
              saveInto: { a!save(local!btnSelected, 2) },
              disabled: contains({ 1, 3 }, tointeger(local!btnSelected))
            ),
            a!buttonWidget(
              icon: "check",
              size: "LARGE",
              style: "DESTRUCTIVE",
              saveInto: { a!save(local!btnSelected, 3) },
              disabled: contains({ 2, 1 }, tointeger(local!btnSelected))
            )
          },
          align: "CENTER"
        )
      }
    )

    Please try this code. I save the value for each button as 1,2 and 3 and according to these values i set the disability logic for the buttons.

Children