cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
_kikilalaaa
Helper V
Helper V

Unsaved changes notification when user select gallery

Hi All.

I have a gallery called OrderRequestGallery and a form called OrderForm. User can fill in and submit OrderForm. Later, they can view their orders in OrderRequestGallery.

My problem is that I want to notify the user that they have unsaved changes. This happens when user edited OrderForm, but suddenly they selected other items in OrderRequestGallery without submitting the form first.

Can anybody helps me?
Thank you!
1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @_kikilalaaa ,

I have made a test on my side, please consider take a try with the following workaround:

7.JPG

 

8.JPG

Set the OnSelect property of the Gallery to following:

If(
   Form1.Unsaved,  /* <-- Form1 represents the Edit form in your app */
   Notify("You have some changes not been saved, please saved your form data firstly!", NotificationType.Warning), 
   Set(CurrentItem, ThisItem)
)

Set the Item property of the Edit form (Form1) to following:

CurrentItem

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @_kikilalaaa ,

I have made a test on my side, please consider take a try with the following workaround:

7.JPG

 

8.JPG

Set the OnSelect property of the Gallery to following:

If(
   Form1.Unsaved,  /* <-- Form1 represents the Edit form in your app */
   Notify("You have some changes not been saved, please saved your form data firstly!", NotificationType.Warning), 
   Set(CurrentItem, ThisItem)
)

Set the Item property of the Edit form (Form1) to following:

CurrentItem

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, thanks for your reply, it works for me but then it has distract other function, which is the templatefill for the gallery is supposed to be blue colour if the item is selected. But, since I use the var current item, the item does not change its colour when it is selected.

I tried to set the templatefill like this:
If(ThisItem.IsSelected = CurrentItem, Blue, White)

But it doesn't work.

Previously, i set the item in form ="OrderGallery. Selected",

and the templatefill in gallery
=(If(ThisItem.IsSelected, Blue, White))

And it works fine.

Please help!

Hi @_kikilalaaa ,

Based on the issue that you mentioned, I think you have some misunderstanding with the ThisItem.IsSelected formula within Gallery control.

The result the ThisItem.IsSelected formula returned is a Boolean value (true/false), which could not be compared with a record value directly. On your side, you need to set the TemplateFill property of the Gallery to following:

If(ThisItem.IsSelected, Blue, White)

2.JPG

 

If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (4,691)