I changed data in text and dropdown values which is there in gallery and when i click on back button it should popup there is unsaved values else it should be back page.
Solved! Go to Solution.
That's simple, please apply the following steps :
This should work for you.
You will need two things:
1) Some indicator (formula) to determine that there are actually changes.
2) A popup series of controls (I would recommend this in a Component to be reusable).
Without knowing any more details about your scenario, this is about all I can suggest at this point.
I hope this is helpful for you.
In order to prevent hitting back, you need to select the top level app page and then set the "Confirm Exit" to true. Then set a message. This is the only way to prevent closing of the app without putting up a message etc. Giving them the option to leave or cancel.
*This assumes by back you mean browser back button. If you mean a back button/icon/image you created in your app, then it's a different scenario :).
Tell me more about what you have designed. However, more importantly is going to be - how are you determining if there is a change? You mention this is a Gallery...what are you doing in the Gallery to enact changes?
@rocky5 the simplest solution I can think of is using the
property of your controls to set a variable to true, such as
and then check for that condition when user clicks on the back button, such as
OnSelect = If(varDataChanged, 'showPopUp', Back())
Of course, this is very simple logic and doesn't tell you if data actually did change, or whether the control was just used, but it may be enough to simply prompt the user that there may be unsaved changes. If you want to be a bit more specific, you can set a hidden checkbox per row to true and then you can point the user to the row that may have unsaved data. Something like this maybe? Add check box in every row of gallery and use collection object to store selected record | Softchief...
Or you can compare default values to current values on controls and then set the variable.
As I said, many ways to go about this, really depends on what you want exactly and how critical is it that you identify individual changes.
How do you save the data by the way?
If you found this response useful, give it a thumbs up and don’t forget to mark your post answered to help others find the solution easier.
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!