web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Field validation and P...
Power Apps
Unanswered

Field validation and Parent.Error

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi there,

 

I am trying to validate a field by displaying an error message when the characters in the field do not meet a certain length.

It works fine but I also want to text box border to go red on an error. Issue is this is a required field so when there is no input the default fieldname is required error appears. I would like my character length error message to behave like this one, where it only shows up after trying to submit the form, then whenever the field is left empty. I cannot figure out a way to get the border to go red without it being either red from the page first loading or getting rid of the border going red for when the field is empty.

 

I also would like to know more about how this Parent.Error work

 

Thanks

 

Categories:
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @Anonymous 

     

    I believe Parent.Error is usually used from a Label control that is the child of a DataCard. Because if there is an error, it will not be on the Label, but the parent DataCard. The default Text property value of a child ErrorMessage label is Parent.Error - this means that the actual DataCard itself, which has an Error property, would be shown in the child ErrorMessage label.

     

    For your Border issue, you want to look at the BorderColor property of the child DataCardValue Text Input field. By default, it usually looks something like this for the Formula:

     

     

    If(IsBlank(Parent.Error), Parent.BorderColor, Color.Red)

     

     

    If one of your DataCards lost this behavior while you were editing them, you can restore this behavior by using something along the lines of the above.

     

    If you want your character length error message to behave the same, go check on how you are showing the message in the first place. If this is working correctly, copy over this similar logic into the BorderColor property of the DataCardValue field, also using the above formula example as a rough reference , and have it change the color to, say, Color.Red if the logic to show the message is true, otherwise, use Parent.BorderColor to not make it red and to show the regular border color if there is no error message.

     

    If you want the border color to be red in more than one case, you may need to check for more than one condition:

     

     

    If(!IsBlank(Parent.Error) || Some_Condition_For_Character_Length_Error_Is_True,Color.Red,Parent.BorderColor)

     

     

    Check if something like above helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard