Site icon @WonderLaura

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?

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.

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.

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”)

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

Exit mobile version