cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nunzie
Helper III
Helper III

Hide Field Based On Value of Another - Using Multiple Form Modes

Hello,

Wondering if I could get some assistance. I have a one page power app. On the left a gallery, on the right a form that is default to View mode. I have a button that then changes the Form to Edit mode allowing users to add a new record. What I'm trying to do is hide Field 3 when the Value of Field 1 is not "Travel" (field 1 is a drop down based on values defined in SharePoint list). I had used 'Request Type'.Value = "Travel" on the visible property of Field 3 which worked great on the view mode, but it did not re-appear when I was in Edit mode trying to add a new record and selecting Travel from the drop down. Just wondering if there is an additional instruction I need to add.  Thanks in advance for any help provided.

 

 

12 REPLIES 12

If(Form1.Mode=FormMode.New&& DataCardValue1.Selected.Value = "Travel" ,true,false)

Try these 6 combinations as your criteria does not seem to be clear to me:

If you want it to work in any form mode:

 DataCardValue1.Selected.Value = "Travel"

Or

DataCardValue1.Selected.Value <> "Travel"

 

If you want it to work in View form mode:

If(Form1.Mode=FormMode.View&& DataCardValue1.Selected.Value = "Travel" ,true,false)

Or

If(Form1.Mode=FormMode.View&& DataCardValue1.Selected.Value <> "Travel" ,true,false)

 

If you want it to work in View and New form mode:

If(Form1.Mode<>FormMode.Edit&& DataCardValue1.Selected.Value = "Travel" ,true,false)

Or

If(Form1.Mode<>FormMode.Edit&& DataCardValue1.Selected.Value <>"Travel" ,true,false)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

View solution in original post

Basically when it's in view mode...and the request type is travel I want to see the two travel related fields, otherwise hide them. When it's in New form, and someone selects travel from the drop down, i want the two travel related fields to appear for completion. Otherwise, in any scenario I do not want the fields seen.

 

I tweaked the last code you gave slightly and it is doing what I want now.

If(Form1.Mode=FormMode.New&& DataCardValue1.Selected.Value = "Travel" ,true,false) Or
If(Form1.Mode<>FormMode.New&& DataCardValue1.Selected.Value ="Travel, true, false)

 

Thank you SO much for your patience with me on this. All because I was not referring to one field properly.  (Facepalm)

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,629)