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
  • 0
    Certified Lead Developer

    The way you use the logic for the disabled parameter seems to be OK. Where and how do you modify the two locals? This should be part of the saveInto of the dropdown.

  • a!localVariables(
      local!buttonVal:0,
      local!btnSelected: true,
      {
        a!boxLayout(
          label: "Tu Escudo",
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!cardLayout(
                      contents: {
                        a!cardLayout(
                          contents: {
                            a!richTextDisplayField(
                              labelPosition: "COLLAPSED",
                              value: {
                                a!richTextHeader(
                                  text: {
                                    "Enfermedades Frecuentes"
                                  }
                                )
                              },
                              align: "CENTER"
                            )
                          },
                          height: "AUTO",
                          style: "NONE",
                          marginBelow: "STANDARD",
                          showBorder: false
                        )
                      },
                      height: "AUTO",
                      style: "NONE",
                      marginBelow: "STANDARD",
                      showBorder: false
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!sectionLayout(),
                    a!dropdownField(
                      label: "Plan Dental",
                      labelPosition: "COLLAPSED",
                      placeholder: "$10,000.00",
                      choiceLabels: {"Option 1", "Option 2", "Option 3", "Option 4",
                      "Option 5", "Option 6", "Option 7", "Option 8",
                      "Option 9", "Option 10", "Option 11", "Option 12"},
                      choiceValues: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
                      saveInto: {},
                      searchDisplay: "AUTO",
                      validations: {}
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!cardLayout(
                      contents: {
                        a!columnsLayout(
                          columns: {
                            a!columnLayout(
                              contents: {
                                a!buttonArrayLayout(
                                  buttons: {
                                    a!buttonWidget(
                                      icon: "check",
                                      size: "LARGE",
                                      style: "DESTRUCTIVE",
                                      saveInto: { a!save(local!btnSelected, 1) },
                                      disabled: contains({ 2, 3 }, tointeger(local!btnSelected))
                                    )
                                  },
                                  align: "CENTER"
                                )

    I have the follow code using solution-

Reply
  • a!localVariables(
      local!buttonVal:0,
      local!btnSelected: true,
      {
        a!boxLayout(
          label: "Tu Escudo",
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!cardLayout(
                      contents: {
                        a!cardLayout(
                          contents: {
                            a!richTextDisplayField(
                              labelPosition: "COLLAPSED",
                              value: {
                                a!richTextHeader(
                                  text: {
                                    "Enfermedades Frecuentes"
                                  }
                                )
                              },
                              align: "CENTER"
                            )
                          },
                          height: "AUTO",
                          style: "NONE",
                          marginBelow: "STANDARD",
                          showBorder: false
                        )
                      },
                      height: "AUTO",
                      style: "NONE",
                      marginBelow: "STANDARD",
                      showBorder: false
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!sectionLayout(),
                    a!dropdownField(
                      label: "Plan Dental",
                      labelPosition: "COLLAPSED",
                      placeholder: "$10,000.00",
                      choiceLabels: {"Option 1", "Option 2", "Option 3", "Option 4",
                      "Option 5", "Option 6", "Option 7", "Option 8",
                      "Option 9", "Option 10", "Option 11", "Option 12"},
                      choiceValues: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
                      saveInto: {},
                      searchDisplay: "AUTO",
                      validations: {}
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!cardLayout(
                      contents: {
                        a!columnsLayout(
                          columns: {
                            a!columnLayout(
                              contents: {
                                a!buttonArrayLayout(
                                  buttons: {
                                    a!buttonWidget(
                                      icon: "check",
                                      size: "LARGE",
                                      style: "DESTRUCTIVE",
                                      saveInto: { a!save(local!btnSelected, 1) },
                                      disabled: contains({ 2, 3 }, tointeger(local!btnSelected))
                                    )
                                  },
                                  align: "CENTER"
                                )

    I have the follow code using solution-

Children
No Data