cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Community Champion
Community Champion

FORMS: Set Form.Error?

Hello,

Is it possible to leverage the Form.Error property without the Submit() function (for an offline app i'm building)?

Use Case:

  • Set Data Cards (in Form) as Required
  • User does not enter a value
  • Clicks "Submit" button
  • Show Errors WITHOUT hitting the SubmitForm() function.

Rationale:

  • This app will use Patch() not SubmitForm()
  • I want to use Form built-in error handling

I'm thinking something like: Set(varAlarms, Form.Error = true), but this doesn' work. Basically, is the SubmitForm() error handling exposed anywhere?

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @ericonline,

Do you want to leverage the Form.Error property when using Patch function instead of SubmitForm function?

I think you have some misunderstanding in the Error proeprty of the Edit form control. The Error property is a user friendly error message to display for this form when the SubmitForm function fails.

The Error property applies only to the Edit form control, and changes only when the SubmitFormEditForm, or ResetForm function runs.

More details about the Error property of the Edit form control, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-form-detail#key-proper...

If you want to leverage the Form.Error property when using Patch function instead of SubmitForm function, I afraid that there is no way to achieve your needs in PowerApps currently.

As an alternative solution, you could consider take a try to add a If condition to check if the Required/Mandatory field is Blank, if yes, notify the user a error message.

I have made a test on my side, please take a try with the following workaround:1.JPG

Set the OnSelect property of the "Submit" button to following:

If(
    IsBlank(DataCardValue7.Text), /*<-DataCardValue7 represents the TextInput box within the Required field (Data Card)*/
    Notify("There are still some Required/Mandatory fields are not provided values in your Edit form",NotificationType.Error),
    Patch('20181122_case14',Defaults('20181122_case14'),EditForm1.Updates)
)

On your side, you should type the following:

If(
    IsBlank(DataCardValue1.Text) || IsBlank(DataCardValue2.Text) || IsBlank(DataCardValue3.Text) || ...,
    Notify("There are still some Required/Mandatory fields are not provided values in your Edit form",NotificationType.Error),
    Patch('YourSPList',Defaults('YourSOList'), EditForm1.Updates) /* <-- your Patch function */
)

The GIF screenshot as below:Test1.gif

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

3 REPLIES 3
Community Support
Community Support

Hi @ericonline,

Do you want to leverage the Form.Error property when using Patch function instead of SubmitForm function?

I think you have some misunderstanding in the Error proeprty of the Edit form control. The Error property is a user friendly error message to display for this form when the SubmitForm function fails.

The Error property applies only to the Edit form control, and changes only when the SubmitFormEditForm, or ResetForm function runs.

More details about the Error property of the Edit form control, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-form-detail#key-proper...

If you want to leverage the Form.Error property when using Patch function instead of SubmitForm function, I afraid that there is no way to achieve your needs in PowerApps currently.

As an alternative solution, you could consider take a try to add a If condition to check if the Required/Mandatory field is Blank, if yes, notify the user a error message.

I have made a test on my side, please take a try with the following workaround:1.JPG

Set the OnSelect property of the "Submit" button to following:

If(
    IsBlank(DataCardValue7.Text), /*<-DataCardValue7 represents the TextInput box within the Required field (Data Card)*/
    Notify("There are still some Required/Mandatory fields are not provided values in your Edit form",NotificationType.Error),
    Patch('20181122_case14',Defaults('20181122_case14'),EditForm1.Updates)
)

On your side, you should type the following:

If(
    IsBlank(DataCardValue1.Text) || IsBlank(DataCardValue2.Text) || IsBlank(DataCardValue3.Text) || ...,
    Notify("There are still some Required/Mandatory fields are not provided values in your Edit form",NotificationType.Error),
    Patch('YourSPList',Defaults('YourSOList'), EditForm1.Updates) /* <-- your Patch function */
)

The GIF screenshot as below:Test1.gif

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

so is there a way to force validation of the powerapp form without the save button being used to submit.  Reason I'm asking is apparantly power app has a new bug.  Old app just broke.  When the user clicks save an gets an error on a required field and fixes it and clicks save again it hangs and wont do anything.  So trying to find a way to maybe add a button to validate the form without submitting in hopes I can work around this new powerapp bug.  Some have suggested in the save button before submit checking all the field but I'm  not going there.  This is a complex form with required fields that are based on other fields.  Any ideas would be appreciated.    Since the submit with errors seems to be the problem, trying to find a way to check fields before submit without doing every field checked again

Hi @dmclaughlin ,

Here is a link to a heap of users with the same issue.

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (37,283)