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

Gallery and form on same screen - view vs edit mode

I have a gallery and a form on the same screen. I also have a button for the user to add a new item. When they click to add a new item, I would like the form to be in edit mode, obviously. Same is true if they select an item from the gallery where the status of the item is not paid -- this will allow them to change the item up until the point it gets paid. Once the item is in a paid status, if they click on the item from the gallery, I would like the form to only display in view mode. Is that possible?

1 ACCEPTED SOLUTION

Accepted Solutions
PowerRanger
Super User
Super User

@AnnetteM Absolutely.

 

So on your Form DisplayMode Property use this formular: 

If(varIsEditMode,DisplayMode.Edit,DisplayMode.View)

 

On your button.OnSelect Property add this formular:

Set(varIsEditMode,true)

 

On Your Gallery.OnSelect Property use something like this:

If(ThisItem.IsPaid,Set(varIsEditMode,true),Set(varIsEditMode,false))

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

4 REPLIES 4
PowerRanger
Super User
Super User

@AnnetteM Absolutely.

 

So on your Form DisplayMode Property use this formular: 

If(varIsEditMode,DisplayMode.Edit,DisplayMode.View)

 

On your button.OnSelect Property add this formular:

Set(varIsEditMode,true)

 

On Your Gallery.OnSelect Property use something like this:

If(ThisItem.IsPaid,Set(varIsEditMode,true),Set(varIsEditMode,false))

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.
NandiniBhagya20
Solution Sage
Solution Sage

Hi,

Yes It is possible. On select property of new button you can add below formula -

Set(varFormMode, “new”)

on select property of gallery or edit icon you can use -

Set(varFormMode, “edit”)

You can use below formula on Default mode of form 

If(varFormMode=“new”, FormMode.New, If(varFormMode=“edit”, If(Gallery1. Selected.Status. Value <> “ Paid”, FormMode.Edit, FormMode.View)))

assumptions -

gallery name is Gallery1

Status column is of type choice and name is Status


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

PowerRanger
Super User
Super User

@AnnetteM 

True what @NandiniBhagya20  wrote. It is FormMode not DisplayMode...




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.
RandyHayes
Super User
Super User

@AnnetteM 

In your Gallery OnSelect, set the following formula:

Set(glbCurrentRecord, ThisItem); Reset(yourFormNameHere)

On your Add button/Icon, set the following formula:

Set(glbCurrentRecord, Defaults(yourDataSourceNameHere)); Reset(yourFormNameHere)

In the DefaultMode property of your form, set the following:

If(glbCurrentRecord.PaidStatus = "Paid", FormMode.View, FormMode.Edit)

 

Substitute names accordingly above.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,528)