oooooohhH!! Thats pretty slick @richcoresln !!
Does that work for partial form submissions?
That sounds useful.
@seadudeyes that is kind of what is being achieved by using this:
If(!Form1.Valid, SubmitForm(Form1), Navigate(CustomFormScreen2));
This is on a "CustomFormScreen1" screens "Next" buttons "OnSelect" function.
This screen would not contain the entire data set available to Form1, with "CustomFormScreen2" containing a "Form2" with the remaining data set.
This could of course be repeated n number of times as necessary (achieving subforms).
We will only be calling Submit for the form when it is not valid; this results in the internal form validation being carried out (and failing as expected) and the forms error messages being displayed, but the submit function does not succeed. To answer your question, a form only seems to validate fields which have been added.
I agree this seems counter-intuitive which is why I would be interested if there was a cleaner way of achieving this (such as a form.Validate() function, however it does not appear so: https://powerusers.microsoft.com/t5/PowerApps-Ideas/Form-validation-without-Submission/idc-p/303558#...).
For completeness, the final form to "Submit" all the previous partial forms would be achieved via patch, this could look something like the following:
If( !Form2.Valid, // Then SubmitForm(Form2), // Else Patch( '[dbo].[MyTable]', Defaults('[dbo].[MyTable]'), Form1.Updates, Form2.Updates ); If( !IsEmpty(Errors('[dbo].[MyTable]')), // Then Notify( "Failed to submit, check your internet connection and try again.", NotificationType.Error ), // Else ResetForm(Form1); ResetForm(Form2); Navigate(Home); Notify( "Subitted new record.", NotificationType.Success ); ); );
Read the announcement for more information!
Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.
Features releasing from October 2019 through March 2020
Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications