Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Hiding error message

(2) ShareShare
ReportReport
Posted on by 551

Trying to get the Error message to go away if the field is filed out - any help is appreciated.  This is tied to a form that is pulling from SharePoint.  I only want it to show the error message if its blank.  (Note that this field is only visible dependent on another field).  Thank you.

Screenshot 2024-07-09 124950.png

  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: Hiding error message

    @joel914823 - assuming you want to preserve the existing out-of-the-box behaviour (display the error warning once the user runs the SubmitForm function on a required field) - you could try:

     

    If(
     IsBlank(DateValue1.SelectedDate),
     Parent.Error
    )

     

    However, because the error message text (Parent.Error) is tied to whenever the data source returns an error, the error message text will continue to be displayed, even if the control inside the datacard has now been populated with a value.

     

    My preference is to control this behaviour more directly. For example:

     

    1. On the OnSelect property of your Submit Button (or whatever you're using to save the record), use:

     

    If(
     'Your Form'.Valid,
     SubmitForm('Your Form'),
     UpdateContext({ctx_highlight_field: true}),
     Notify(
     "Please complete all mandatory fields",
     NotificationType.Warning
     )
    )

     

    2. On the BorderColor property of the DataCard:

     

    If(
     ctx_highlight_field,
     Color.Red,
     Color.Transparent
    )

     

    3. Modify the Text property of the error message Label control with e.g. "The date field is mandatory."

     

    4. Set the Visible property of the Label to:

     

    ctx_highlight_field

     

    5. Set the OnVisible property of the Screen to: 

     

    UpdateContext({ctx_highlight_field: false})

     

    Optional: If the Item property of the EditForm is being populated from a Gallery control on the same screen, then on the OnSelect property of the Gallery, include:

     

    UpdateContext({ctx_highlight_field: false})

     

  • KeithAtherton Profile Picture
    3,646 Most Valuable Professional on at
    Re: Hiding error message

    Hi @joel914823,

     

    Can you share the code for the error message text label control (where it says "Resolved Date is Required") Visible property please?


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Connect with me online.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,026 Most Valuable Professional

Leaderboard