The Unsaved property of my Edit Form form always has a value of true, even when I have made no changes. My form is in FormMode.Edit.
As a test I created a button with this code in the OnSelect property. The Edit Form still shows Unsaved as true after I click the button
ResetForm(Form1);
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
I see that we're 6 months later, and still no fix, or even a response from Microsoft....
Just to let you all know that I'm still having major issues with Form.Unsaved - it is simply not usable.
@v-bofeng-msft - Please can we have some sort of response from Microsoft?
James.
Hi guys,
I think I found a possible workaround. I included a ResetForm(FormWithTheIssue) on the Onvisible of the screen where the form is located.
That seems to have fixed my issue.
Hope it helps
Manuel
I don't think that a form reset is a universal solution. Having hit this issue, I added a button with an OnSelect property of ResetForm(formName) and the form's Unsaved property remains true . My experience is that loading a record into a form sets the Unsaved property to true, and this remains even after a form reset. The Unsaved property is only set to false when the form is first in New mode.
One thing I've notice that can cause the .Unsaved property to not behave as expected is default values. This is because after the form is loaded it sets the defaults. If these defaults differ from what is stored in the data source (SharePoint in my case) then it will consider the data changed. Ultimately, I believe the .Unsaved property is only triggered when something on the field on the form differs from what is in the database and that by coding things certain ways you can have unintended consequences that cause this to happen.
The best solution to avoid this is to move away from the use of form using the Submit command and move to using Patch, which will give you much more control over when things are determined as Saved or Not Saved as well as other aspects of programming in PowerApps. While I still use forms occasionally, it is when I just want to do something quick. Anything that is going to be a long term solution for users I believe you'll want to migrate or start with the Patch method of saving your data. Doing so will save you a lot of headaches. Not to mention it is much easier to change your data source from say Sharepoint to SQLServer using this instead of the Form with Submit.
Hope this helps,
Steve
I posted this above as a reply, but meant it for you:
One thing I've notice that can cause the .Unsaved property to not behave as expected is default values. This is because after the form is loaded it sets the defaults. If these defaults differ from what is stored in the data source (SharePoint in my case) then it will consider the data changed. Ultimately, I believe the .Unsaved property is only triggered when something on the field on the form differs from what is in the database and that by coding things certain ways you can have unintended consequences that cause this to happen.
The best solution to avoid this is to move away from the use of form using the Submit command and move to using Patch, which will give you much more control over when things are determined as Saved or Not Saved as well as other aspects of programming in PowerApps. While I still use forms occasionally, it is when I just want to do something quick. Anything that is going to be a long term solution for users I believe you'll want to migrate or start with the Patch method of saving your data. Doing so will save you a lot of headaches. Not to mention it is much easier to change your data source from say Sharepoint to SQLServer using this instead of the Form with Submit.
Hope this helps,
Steve
User | Count |
---|---|
251 | |
102 | |
94 | |
48 | |
37 |