Power Apps Button OnSelect [With Examples]

Have you ever worked with Power Apps Button OnSelect? If not, follow this Microsoft Power Apps tutorial to learn an overview of Power Apps Button OnSelect and how to work with Power Apps Button OnSelect.

Also, we will discuss some more topics below with various examples:

  • Power Apps Button OnSelect Change Text
  • Power Apps Button OnSelect Navigate Screen
  • Power Apps Button OnSelect Open URL
  • Power Apps Button OnSelect Change Color

Overview of Power Apps Button OnSelect

1. Power Apps Button OnSelect is a Property that helps to do some actions when the user taps/clicks on it. For example, when a user clicks on the Button, it will be disabled like below:

How to Use Power Apps Button OnSelect

2. Power Apps Button OnSelect can be found on the menu buttons, where navigation is needed to move other screens.

3. Power Apps Button OnSelect property is needed for when you want your button to do something; add your code to trigger an action in Power Apps.

4. Instead of coding, we can’t do anything in the Power Apps Button OnSelect. And it runs one or more functionalities when the user clicks or taps the Button control.

Power Apps Button OnSelect Examples

Let us see how to add actions in the Power Apps Button OnSelect. Such as:

  • Power Apps Button OnSelect Change Text
  • Power Apps Button OnSelect Navigate Screen
  • Power Apps Button OnSelect Open URL
  • Power Apps Button OnSelect Change Color

Power Apps Button OnSelect Change Text

Suppose you want to change the Text in the Power Apps Button OnSelect, then follow the below steps:

1. Click on the Button control, rename the Text (Save), and set its OnSelect property to the code below:

OnSelect = Set(gblClicked,true)

Where,

  • Set() = This Power Apps function is used to set the global variable to store a piece of information
  • gblClicked = Power Apps Global Variable Name
Power Apps Button OnSelect Change Text

2. Next, select the Text property to change the Button text (If the user wants to Save Again by the second click of the Save button). And set its Text property to the code below:

Text = If( 
    gblClicked,
    "Save Again",
    "Save"
)

3. Save, Publish, and Preview the app. When the user clicks on the button control, the text property will change as in the screenshot below.

How to change text in Power Apps Button Onselect

This is all about the Power Apps button OnSelect change text.

Power Apps Button OnSelect Navigate Screen

Next, we will discuss the Power Apps button OnSelect to navigate the screen. To do so, follow the below steps are:

1. Click on the Button control, and rename the text (Go to screen). Next, set its OnSelect property to the code below:

OnSelect = Navigate('Success Screen')

Where,

  • Navigate() = This function can be used to redirect to other screens
  • ‘Success Screen’ = Name of the other screen
Power Apps Button OnSelect Navigate function

2. Save, Publish, and Preview the app. Once the user clicks on the Navigate button, it will redirect to the other screen (Sucess Screen) like below:

Navigate function in Power Apps Button OnSelect Property

This is how to use the navigate function in the Power Apps Button OnSelect.

Power Apps Button OnSelect Open URL

Let’s see how to open a URL in the Power Apps Button OnSelect. To do so, observe the below steps:

1. Click on the Button control, and rename the text (Go to URL). Next, set its OnSelect property to the code below:

OnSelect = Launch("https://xyz.sharepoint.com/sites/DutchCrafters")

Where,

  • Launch = This function helps you to open links in your browser from the App
  • “https://xyz.sharepoint.com/sites/DutchCrafters” = SharePoint Online Site URL address
How to add actions in Power Apps Button OnSelect Property

2. Save, Publish, and Preview the app. Once the user clicks on the Navigate button, it will redirect to the respective SharePoint Online Site as in the screenshot below.

Power Apps Button OnSelect Open URL

This is how to open a URL in the Power Apps Button OnSelect.

Power Apps Button OnSelect Change Color

In the last, we will see how to change color in the Power Apps Button OnSelect. To achieve this, follow the below steps:

1. Click on the Button control (Save), and set its OnSelect & Fill properties to the code below:

OnSelect = UpdateContext({togglevalue:!togglevalue})

Fill = If(togglevalue,Color.DarkRed,Color.AliceBlue)

Where,

  • UpdateContext = This function is used to create a Power Apps context variable to store information
  • togglevalue = Power Apps Context Variable Name.
How to Change Color in Power Apps Button OnSelect Property

2. Save, Publish, and Preview the app. Once the user clicks on the Button control, it will change the color to either DarkRed or AliceBlue, as in the screenshot below.

Power Apps Button OnSelect Change Color

This is how to Change Color in the Power Apps Button OnSelect.

Conclusion

This Power Apps tutorial helps us to learn an overview of the Power Apps Button OnSelect. It is also covered below topics such as:

  • Power Apps Button OnSelect Change Text
  • Power Apps Button OnSelect Navigate Screen
  • Power Apps Button OnSelect Open URL
  • Power Apps Button OnSelect Change Color

Also, you may like some more Power Apps tutorials: