Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

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

  • 0
    Certified Lead Developer

    Hi, you would need to save values on click of each button, you can use local variables to save your values. And the use this local variables to configure disable parameter of each button.

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

  • +1
    Certified Lead 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.

  • It works, but just disabled the button number one and it doesn't let me choose another one.

    The 3 buttons must be enabled.

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

  • I made a few changes on the code, I created 7 local variables because I have 24 buttons and every row is different

    Thank you a lot,

  • 0
    Certified Lead Developer
    in reply to AldairV

    Yes, Based on the requirement we can change the disable condition.

  • 0
    Certified Lead Developer
    in reply to AldairV

    You can also use a!map instead of so many local variables. That would also give you control on which index of map you want to work on if you are building this grid dynamically.