I am having a very odd behavior with my forms. Here is what I have.
Screen1
4 forms - Form4(master) and Form1, Form2, Form3
The OnReset for the Form4 form resets the first 3
ResetForm(Form1); ResetForm(Form2); ResetForm(Form3);
A submit button that is only editable(clickable) when Form1, Form2, and Form3 are valid
If(Form1.Valid && Form2.Valid && Form3.Valid, DisplayMode.Edit,DisplayMode.Disabled)
Now, the first time through the app everything works properly but if I try and add a new record the Submit button becomes active after getting through 3 of the 5 required fields in Form1. I have no idea why the others are validating. If I look at Form4 I see values in fields that should be reset. This is the code I am using on a temporary 'reset button' and the 'new' button.
//Rest button
UpdateContext({ShowPreview: false}); Set(glbFormData,Defaults('Tracking DB')); ResetForm(Form4)
//New button
Set(glbFormData, Defaults('Tracking DB')); ResetForm(Form4); Navigate('Build Tracking')
Any ideas why this is happening? This would probably solve another issue I've been having if I could understand why these From4 values are still around.
Been searching the interwebs to see if I missed anything. ResetForm does nothing to blow away those values that keep populating my master form. It seems like it has something to do with the Default or Update value that seems to stay around even after a reset.
I don't know if I need to open a new thread or if we can work through solving this problem but this is currently a big roadblock with moving the app development forward.
Set up some labels to see what stays after a reset for the Brand1 value
@RandyHayes
"if you look at the record in the formula editor (the resultant record from the Patch), does it show data that it shouldn't or is it pretty empty?"
There are values there.
@RandyHayes
I found this forum post to clear the Parent.Default value but this won't work right since the FormMode is never New correct?
https://powerusers.microsoft.com/t5/Building-Power-Apps/Parent-Default-retains-a-default-value-from-a-form-submission-Is/td-p/578981
@RandyHayes
In addition to my last post I am wondering one other thing. If I look at the default value for the datacard in Form2 for the Brand (Brand1_DC.Default) there is no value. That datacard has a custom control(combobox). If I look at the default value for the datacard in Form4 for the Brand(Brand1_DC1.Default) the value returns the brand that was there prior to reset. Also, the control in Form4 for Brand is a text box and not a combobox. Not sure if that matters any.
The Default for both datacards is ThisItem.Brand1. Hope this helps
@RandyHayes
Completely missed your response. The controls, since they are comboboxes, only have a DefaultSelectedIrtems property which typically looks like this unless there is some additional logic to control the DisplayMode of the control.
{crfeb_brandname:Parent.Default}
I also get this error when I set the OnReset value to the form control
Edited:
The Default for the datacard is ThisItem.Brand1
Ah yes the custom controls...
Are the Default properties of those controls referencing Parent.Default or are they deriving their values through some other means?
You can also put in the OnReset action of the child forms individual Resets for the comboboxes and other controls that need to reset. i.e. Reset(yourCombobox); Reset(yourOtherCombobox) etc.
It looks like all of the datacards where I removed the default text field and replaced with a combobox that do not get reset. In the Form4 Item the glbFormData variable is empty. The FormN.Updates all show the hold-over data that didn't get reset.
So, is there a particular field or set of fields that don't seem to be getting reset, or is it all of them?
And how about the Item property on Form4...if you look at the record in the formula editor (the resultant record from the Patch), does it show data that it shouldn't or is it pretty empty?