Show or hide fields based on choice values in Power Apps

This post describes how to show or hide fields based on a choice column from a SharePoint list in Power Apps.

I was recently working on a Power App form for new site/ teams requests. The fields were all based on SharePoint list columns and one of the key fields was a choice column. What I wanted to do was have an additional field default to being hidden from the screen unless a particular choice value was selected.

Now I’ve used the Microsoft guidance to create dependant drop-downs before but this scenario was slightly different and it was based on a choice column which isn’t compatible to my knowledge. I’d done something before in my Power App to toggle the display mode of a button in my app if fields are blank. So starting with this I used a simple if function in my formula to show/ hide my field based on the selected choice value.

Solution

Here’s how to hide a field based on a choice value in Power Apps:

  • Open your Power App to edit it > ensure both the choice field and the field you want to hide are added to the screen
In this example, a drop-down list will be hidden by default until project site is selected from within the request type choice field.
  • Select the data card for the field you want to hide until a choice value is selected
  • In the top, left-hand corner of the Power Apps editor, select the visible property
Select the Visible property when selecting the hidden field in your PowerApp.
  • Add the following if statement to the formula bar, replacing the parts highlighted below:

If(rdoRequestType.Selected.Value="Project site",true,false)

  • Replace rdoRequestType with the name of your choice control
  • Replace “Project site” with the selected value from your choice field

Now, by default your field will be hidden from the screen until you select the relevant choice value!


2 thoughts on “Show or hide fields based on choice values in Power Apps

  1. kathy April 13, 2022 / 11:27 pm

    what is the function for visibility based on more than one choice value?

    Like

    • Anthony April 14, 2022 / 1:57 pm

      Hi Kathy, thanks for the comment. well in my example im using the DisplayMode property to disable/ enable the button. So if I wanted to to disable it until two fields were not blank I would use something like this:

      If(IsBlank(DataCardValue4) || IsBlank(DataCardValue5), DisplayMode.Disabled,DisplayMode.Edit)

      (DataCardValue = your field)

      Like

Leave a Reply to kathy Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s