How to Enable/Disable Button Logic in Canvas App?

How to Enable/Disable Button Logic in Canvas App?

If the user clicks on one button, the rest buttons should be enabled/disabled based on the condition.

High level resolution steps

  • In Screen I have three buttons “Button1”, “Button2” and “Button3” and on click of “Button2”,
    I want “Button1” and “Button3” to be enabled
  • When we navigate to the same screen back then, “Button1” and “Button3” should get disabled again.

Detailed resolution steps

Step 1: Adding 3 buttons on the empty screen in a canvas app

Enable/Disable Button Logic in Canvas App

Step 2: Now set a global variable on the OnSelect property of “Button2”.

OnSelect
Set(disablebutton,true)

Step 3: Set DisplayMode property for “Button1” and “Button3”.

DisplayMode
If(disablebutton,DisplayMode.Edit,DisplayMode.Disabled)

Step 4: Now in the Arrow Right button set the OnSelect property to navigate to the second screen as shown in the below picture:

OnSelect
Navigate(Screen2)

Step 5: Now in the Arrow Left button set the OnSelect property to navigate to the first screen and in the first screen “Button1” and “Button3” will be disabled back again.

Output

This way you can Enable/Disable Button Logic in Canvas App.