Not sure if this is a bug or expected behavior, i have a form with a bunch of text boxes, lookups, dates etc all going back to an SQL database.
If i setup the form with dates, dropdowns (with the correct allowed values and defaults) the Form.Unsaved works correctly, make a change to a drop-down, updates = true, change back , updates = false. THe issue comes in with Text boxes. The fields in the database default to ('') and then are are varchar(5000). PowerApps will always report that the form has changes when it loads even if the field is blank. I found that if you add TrimEnds() to the default value of the data card (for example TrimEnds(ThisItem.Issue1) where issue1 is a field) then it works correctly. Anyone else come across something like this or am i missing something in the database setup?
I'm also seeing form.Unsaved as always true.
I need to monitor state of the form in order to control the DisplayMode of the Submit button.
- If no changes have been made, DisplayMode.Disabled else .Edit
Also need to monitor state of form to control visibility of "Are you sure?" popup
- If changes have been made, show "Are you sure?" popup else navigate directly to previous screen
.Unsaved was my method. Now no longer seems to be working. Need help here.
Also issues with Form.Valid?
- I have 4 fields marked as Required (see asterisks)
- The text box is set to: "Is this form valid?: " & Form.Valid
- As you can see its set to true.
- It should be false until the required fields are filled in.
- The Default property for these fields is set to:
- If(frmForm.Mode = FormMode.New, Blank(), Parent.Default)
- Also tried just setting them to Parent.Default. No change. .Valid still evaluates to true.
Whats up here? I use .Valid for a lot of things!
This issue is there for several months now. MSFT does not react on it. I made an app which sometimes shows .Unsaved correctly and sometime not. I think this is a bug. One thing to be aware of is that this property only works on a Edit form (which you can switch in mode of course).
I was having this same problem, but mine is not querying a SQL table. Solution seems to be in the cards, and I believe there are some back end connections that are best left untouched. Flip any cards that you don't want touched to DisplayMode.VIEW and similarly, if you have fields that you want to customize the default properties for display purposes only within a card, I would instead put an additional text box or something - not change the properties of the original control. Simply flip the card's original control to Visible false. With the new control you have added, you can use the ThisItem property to propagate a custom field within a card without messing with the cards default properties. The heart of what I believe was screwing up mine was that I attempted to copy and paste prior constructions and just change the update property of the card to the new field, that seemed to disassociate the appropriate defaults and permanently render the form unsaved=true. Solution is to delete the custom cards and rebuild from scratch. For mine, I had added custom field that I DID want to have updated with form submission, so I added a patch function ahead of the submitform function to update that field. Naturally, that workaround doesn't update the Unsaved property of the form. You could do something like write an addendum to your needed Unsaved formula to check if the exogenous control's current state matches the record's "default" state for that field, but this adds an additional query to the server. For example: Lookup(DatabaseName, ID=IDDataCardValue.value).Exogenous=ExogenousControl.value
That's a really good question - since I'm not using and haven't tried any validation formulas I don't have a good answer. However, my first shot would be to place the validation formula in the submit form button. Mind you, cancel form, you will also want to reset(exogenouscontrol) in addition to resetform(form)
I experience the unexpected behavior as well. (again)
I use a lot of forms in my apps, and I have yet to figure out the reason for this unexpected behavior. I sometimes have to re-create the entire form to resolve it 😕
There are other issues with forms that I have speculated to be related to the Unsaved property. e.g the order and layout of fields when some fields (datacards) are hidden. again, pure speculations.
When issues are not answered in the forum I'd suggest creating a ticket:
I created a "pure" PowerApp from a SharePoint list as my reference. So I added a label on the EditScreen and it showed "false" for EditForm1.Unsaved - as expected.
I could also move and resize input fields without issue.
But as soon as I replaced the Default value of one input field from Parent.Default to a formula the label text would switch to "true" and just stay there - until I changed the Default value back to Parent.Default.
That is annoying!
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Did you miss the call? Check out the Power Apps Community Call here.
We are excited to announce the Power Apps Super Users!
Check out our new profile badges recognizing authored solutions!