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 Apps
Unanswered

Submitting a form

(0) ShareShare
ReportReport
Posted on by 171

Hello - when a user changes a field or dropdown, I set a varDataChange = true which then makes a SubmitForm button visible (and then we use submitform(frmName) to update the data in sql server. The problem is that the var is not set until the user clicks out of the field. So if they change a data item, don't click out, they can easily leave the form by accident with no real change to the data. Suggestions please on a better approach? Thanks!

Categories:
  • SebS Profile Picture
    4,867 Super User 2026 Season 2 on at

    @CedarTree72 

     

    Initialize this variable like UpdateContext({varDataChange: false}) in the OnVisible property of the screen so that when the user gets to the screen, it will be false, and when the user uses control or text input, it will change to true. 

  • CU04021832-1 Profile Picture
    171 on at

    If the user is moving between records using a vertical gallery on the left, and editing each record on a "subform" on the right, does that change your suggestion? When does the OnVisible event actually trigger if someone never "changes screens"? Thanks.

  • SebS Profile Picture
    4,867 Super User 2026 Season 2 on at

    OnVisible will run the variable when the user enters the screen that's when the user switches from screen to screen or the app is starting on that screen . You can also set variable from App.OnStart by adding there code  Set(varDataChange, false) and every time the app starts that variable will be set to false. Everything depends on the scenario and how you navigate the user to that form.

  • CU04021832-1 Profile Picture
    171 on at

    Okay, so when I update a date picker field or a dropdown, the app deems the data has changed and behaves correctly. But for a free entry field, it waits until you've moved to another field to assess if the data has changed. How can I address this please? THANKS.

  • SebS Profile Picture
    4,867 Super User 2026 Season 2 on at

    @CedarTree72 

     

    Personally, I would add code to the Visible property of the button:

     

    If(IsBlank(DataCardValue1.Value) && IsBlank(DataCardValue2.Value) && IsBlank(DataCardValue3.Value), false,true)

     

    Or use DisplayMode property:

     

    If(IsBlank(DataCardValue1.Value) && IsBlank(DataCardValue2.Value) && IsBlank(DataCardValue3.Value), DisplayMode.Disabled,DisplayMode.Edit)

  • zuurg Profile Picture
    546 Super User 2024 Season 1 on at

    Have you considered setting your Submit button's visible property to frmName.Unsaved?

     

    Unsaved is a boolean that determines if a form's current field contents is different than the field's default value.  So even if they don't click out of the field, it would still come up as true if the value has changed.

  • CU04021832-1 Profile Picture
    171 on at

    Thanks @zuurg / @SebS. The unsaved property works but it seems to me that it must use cookies? Because it starts out with all records unsaved, and then as I save them, it turns off the submit button. Will that hold true for another user who comes to the same record? Will it default to being saved or unsaved? Or can I from an outside control (eg, gallery) set seach record to be Saved when you first land on the record?

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard