PowerApps Custom Field Errors

Have you ever filled out a form in PowerApps, missed a few required fields, and were presented with something ugly like this?

powerapps-fields-missing-required

In this post, I’ll show you how you can customize those little red error messages on required fields, to make them say something more specific / custom.  First of all, here’s some information about the error message.  In each card, by default there is an extra label called “ErrorMessage##”.  In this screenshot example, mine is called ErrorMessage8.  This label is hidden by default, and if a field that is required is submitted without being filled out, it appears and shows this generic error.

powerapps-fields-missing-error

Here are a couple of important properties of this error message label:

The visible property: Parent.DisplayMode=Edit

This means that it only shows if the form is currently being edited, such as with a new or edit form, not when you’re just viewing an existing form.  Remember, the Visible property is just a boolean, so whatever formula is in there, just needs to evaluate to true or false.

The AutoHeight property: true

This means that the height of this label will only expand to the length of the text that is showing.  If there is no text being displayed, this label isn’t taking up a bunch of extra space on the form.

The Text property: Parent.Error

This is the property that we’ll be focusing on in this post.  These three steps need to be done on each card where you’d like to see a custom error message.

powerapps-card-error-text

1.  Unlock the card, and select the error message label in the card.

2.  Go to the Text property in the drop-down at the top.  As seen in the screenshot above, you’ll see Parent.Error in there already.

3.  In my example, I want the message for this “Destination” field to be “Please fill in a destination”.  We’ll be doing a formula that looks to see if the error is not blank, and if it is not blank, display my custom message.  The formula is:
If(Not(IsBlank(Parent.Error)),“Please fill in a destination”)

powerapps-card-custom-error

I know, it would be nice to be able to just use the description from SharePoint to be able to show it in the card, or to be able to show it here when data is missing, but this is currently not possible.  There is an idea in the PowerApps community that has been posted, and you can vote for this feature to be added.

Here’s a related post that I wrote, about custom validation, too. PowerApps Text Input Pattern Validation

Reference: Card control in PowerApps

6 comments

  • You always have great tips, very useful.

  • Thanks Laura!

  • The correct formula is:
    If(Not(IsBlank(Parent.Error));“Please fill in a destination”)

  • I am trying your steps but my example is
    If(Not(IsBlank(Parent.Error));“Scope Description is required”) – Its stating error in formula. Did something change on this?

    asking for – Edit your formula so that it includes an operator between the operands.

  • Thanks Laura! I adjusted and still received an error. Just sharing if it could help someone else. My quotes were curled fancy vs standard “. I just hand wrote vs copy pasting and editing and then doing side by side the quotes were slightly different.

    This is the error if anyone else everyone comes across-
    ‘U+201c’ at position ’30’ in the formula
    For example, the character \ isn’t expected after a number, like this: ’32\’. A space is expected. – fix was adjust your quotes.

    Thanks again!

Leave a Reply