cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

oooooohhH!! Thats pretty slick @richcoresln !!
Does that work for partial form submissions?
Example:

  • 60 field form
  • Split into "Subforms" for usability
  • Can you check .Valid on a certain section (Form1), then, IF Valid, move to next section (Form2)
  • Repeat, but have each SubForm submit results (Patch, really) to the original record?

That sounds useful.

richcoresln
Level: Powered On

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

@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
        );        
    );    
);
ToHe
Level: Powered On

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

@richcoresln That is nifty! Complex issue solved with a simple fix! Thanks!

Jason-michael-r
Level: Powered On

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

There is a 500 Control limit so there is a limit how big your single screen can be

Jason-michael-r
Level: Powered On

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

If its low code no code this needs to be easy to do, otherwise simple Tasks are easier in Full Stack 

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,983)