cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted

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

Highlighted

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

Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,216)