Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Conditional Validation in PowerApps

Like (0) ShareShare
ReportReport
Posted on 10 Nov 2023 14:06:02 by 109

Hi community,

I have an edit form in my powerapp generated from a sharepoint list .Now i need to add conditions in the validation of a specific datacard (eg characters need to be more than 3) without breaking the rest of controls in Datacard.How can i achieve this please?

  • Hassan_SZ_365 Profile Picture
    542 on 10 Nov 2023 at 16:18:03
    Re: Conditional Validation in PowerApps

    Hi @Mikellas ,

    1. First Solution Attempt: @PowerYsa suggested using the If() function in the DisplayMode property to disable the data card if the text input was less than 4 characters. However, @Mikellas clarified that they did not want to disable the card but wanted it to show a validation error.

    2. Second Solution Attempt: MudassarSZ365 proposed using the "Valid" property in the data card, with a formula Len(DataCardValue.Text) > 3 to check if the text has more than three characters. However, this approach was later corrected by another community member, stating that data cards do not have a 'Valid' property.

    3. Third Solution Attempt: The same user, MudassarSZ365, then suggested adapting the Required property with an If statement. But @Mikellas expressed confusion about this solution, fearing it might only make the field not required rather than enforcing a character limit.

    4. Final Suggestion: @timl recommended adapting @SpongYe's initial advice to use the Required property for validation. This approach aims to validate the character count without disabling the card or breaking other controls.

    The conversation highlights the iterative process of problem-solving in community forums and the need for clear understanding of PowerApps functionalities and properties.

    Best Regards,
    Hassan Raza

  • NM-06090901-0 Profile Picture
    109 on 10 Nov 2023 at 15:32:11
    Re: Conditional Validation in PowerApps

    Hi @timl .Wont that just make the field not required?I feel confused. hahah

  • timl Profile Picture
    34,978 Super User 2025 Season 1 on 10 Nov 2023 at 14:49:42
    Re: Conditional Validation in PowerApps

    @MudassarSZ365 - I'm not sure what you're using to generate these answers, but data cards do not contain a Valid property.

    @Mikellas - I would suggest that you take @SpongYe's advice here in terms of adapting the Required property to carry out this validation. 

  • SpongYe Profile Picture
    5,580 Super User 2025 Season 1 on 10 Nov 2023 at 14:22:39
    Re: Conditional Validation in PowerApps

    You could also use it for Required

    If(
     Len(TextInput1.Text) > 3, 
     true, 
     false
    )

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • NM-06090901-0 Profile Picture
    109 on 10 Nov 2023 at 14:18:35
    Re: Conditional Validation in PowerApps

    Hi Spongey and thanks for the prompt trply but i dont want to disable the card i just want it to throw the usual validation error thats the form has

  • SpongYe Profile Picture
    5,580 Super User 2025 Season 1 on 10 Nov 2023 at 14:12:27
    Re: Conditional Validation in PowerApps

    @Mikellas 

     

    If() function to evaluate multiple unrelated conditions in your data card.

    If you want to validate that the text input is not blank and has more than 3 characters.

    You can use this formula in the DisplayMode property of the data card:

    If( 
     IsBlank(TextInput1.Text) || 
     Len(TextInput1.Text) < 4, 
     DisplayMode.Disabled, 
     DisplayMode.Edit
    )

     

    Disable the data card if the text input is blank or has less than 4 characters, and enable it otherwise.

     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

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!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,788 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,093 Most Valuable Professional

Leaderboard
Loading started