web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Back button should onl...
Power Apps
Answered

Back button should only work if entries have been saved

(0) ShareShare
ReportReport
Posted on by 10

Hello all,

I am building an app where users are supposed to edit entries. These should of course be saved with the following formula on my save button:
SubmitForm(Detail_Form) & Navigate('Main Screen')

But I also want to create a back button, because sometimes users just want to view the entries and not save something directly. What formula do I need, to make this back button only clickable when the content is already saved/ or nothing was changed?

Also, if the button is not clickable, a text should appear that says "please save first".

Categories:
I have the same question (0)
  • Verified answer
    madlad Profile Picture
    2,637 Moderator on at

    In the visibility or displaymode you could use the "form.Unsaved" property which will return 'true' if changes have been made. 

    If it's visibility, just this will suffice, but if you want it disabled, you'll want something more like

     

    If(Form.Unsaved, DisplayMode.Disabled, DisplayMode.Edit)

     

     

    Then, just do the "!Form.Unsaved" as the visibility in a text label with "please save first"

     

    ^Just make sure to sub in your form's name in these

     

    Hope this helps!

  • rikdekoning Profile Picture
    281 on at

    As an additional tip, may I suggest that you put your Navigate action inside the OnSuccess of your Form instead of directly after the SubmitForm action inside your button? This way, you always make sure that the Navigate will only happen if your data is submitted successfully.

  • Talha_Dar Profile Picture
    870 Super User 2024 Season 1 on at

    Hi @JanaKH,

     

    You can achieve this by following these steps. First, set a variable on the button or icon that enables users to edit the form, like:

     

    Set(AllowNavigation, false)

     

    Then, on your form submit button, update the variable to allow users to navigate using the formula:

     

    Set(AllowNavigation, true)

     

    Finally, add the following logic to your back button:

     

    If(AllowNavigation, Back(), Notify("Please Save The Record Before Navigating"))

     

    This logic will check if the variable "AllowNavigation" is true, and if so, it will navigate back. If the variable is false, it will display a notification asking the user to save the record before navigating.

     

    I hope this helps! Let me know if you have any further questions.

     

    If you found my answer helpful, please consider giving it a thumbs-up or a like. Your feedback is greatly appreciated!

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard