cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
iotc
Level: Powered On

How to duplicate the error checks and validation performed by SubmitForm when using Patch

It it possible to duplicate the error checks and validation that SubmitForm does when using Patch?.

 

According to the documentation:

"Before submitting any changes, this function checks for validation issues with any field that's marked as required or that has one or more constraints on its value. This behavior matches that of the Validate function.

SubmitForm also checks the Valid property of the Form, which is an aggregation of all the Valid properties of the Card controls that the Form control contains. If a problem occurs, the data isn't submitted, and the Error and ErrorKind properties of the Form control are set accordingly"

 

I want to duplicate this when I use Patch instead of SubmitForm.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to duplicate the error checks and validation performed by SubmitForm when using Patch

Hi @iotc,

 

1) For Error checking, I think it cannot be duplicated by Patch function, since in the documentation, you can also see that:

 

Error 

  • This property changes only when the SubmitForm, EditForm, or ResetForm function runs.

2) For validation, you could add a Label beside the Form, set its Text property to:

 

ErrorMessage

Set the OnSelect property to the save button to:

If(EditForm1.Valid=true,Patch(...,...,...),UpdateContext({ErrorMessage:"XXXXXX"}))

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: How to duplicate the error checks and validation performed by SubmitForm when using Patch

Hi @iotc,

 

1) For Error checking, I think it cannot be duplicated by Patch function, since in the documentation, you can also see that:

 

Error 

  • This property changes only when the SubmitForm, EditForm, or ResetForm function runs.

2) For validation, you could add a Label beside the Form, set its Text property to:

 

ErrorMessage

Set the OnSelect property to the save button to:

If(EditForm1.Valid=true,Patch(...,...,...),UpdateContext({ErrorMessage:"XXXXXX"}))

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

iotc
Level: Powered On

Re: How to duplicate the error checks and validation performed by SubmitForm when using Patch

Thank you for this clarification. I have posted an idea to allow hiding the "There was a problem saving your changes The data source may be invalid" error message generated by SubmitForm when the underlying datasource is a SQL Azure view rather than a table. This would allow a following Patch function to multiple tables, while gaining all the error checking and validation that SubmitForm does.

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 (9,796)