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

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!


6 responses to “Show or hide fields based on choice values in Power Apps”

  1. Hi Matt, thanks for both comments and including how you solved this. I’m sure it will be really helpful for others too!

    If you need anything else, just shout.

    Cheers,
    Anthony

  2. Very helpful, thank you! In my sample, I hide a dropdown if a certain option is selected from another dropdown:
    If(DataCardValue7.Selected.Value=”Data Processor”,false,true)

    But, I need to drill down one step further. I need to hide an option in a dropdown if a certain option is selected from another dropdown.

    Basically,
    If(DataCardValue7.Selected.Value=”Data Processor”, then Hide only the “N/A” option in DataCard8.

    Is this possible, or do I need to do some sort of cascading setup? Thanks in advance for any assistance.

    1. I got it to work. Posting here in case anyone else needs it.
      If(DataCardValue7.Selected.Value=”Data Processor”,Filter(Choices([@Applications].Status),Value”N/A”),Choices([@Applications].Status))

      Basically, if DataCardValue7 dropdown choice is equal to Data Processor, then hide ONLY the N/A choice in the Status dropdown.

      Thank you for letting me share. Please keep up the good work!

  3. This was a helpful reminder – you don’t need to push it out from the OnChange event of the Choice field – just let it be a “pull” from the other fields you want to change based on the Choice field! It’s simpler, but not intuitive.

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

    1. 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)

Leave a Reply to kathyCancel reply

Recent posts

Discover more from SharePoint Stuff

Subscribe now to keep reading and get access to the full archive.

Continue reading