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 / I am trying to make co...
Power Apps
Unanswered

I am trying to make components inside any gallery item follow some validation.

(0) ShareShare
ReportReport
Posted on by 280

Basically i have a gallery with three input fields in each item. I want first input_field to allow only 11 characters , similarly second input should allow < 6 characters and third one should allow only 1 character. 

 

Now i want to check in the whole gallery if any input field is not obeying the rule , i want to hide the submit button in that case.  

 

For Better Understanding ----->

GALLERY

1 item = 3 input fields with the above validation rules mentioned. 

2 item = 3 input fields with different validation rules. 

 

And the submit button should be disabled in-case any input field is not following the validation. 

 

I know its complex and thats why I need some help. 

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @PAJ,

     

    You can actually enforce the maximum allowed characters in a Text Input by using the MaxLength property of that control. The first would be set to 11, second to 5 and last to 1. Typing more characters will simply not be possible within those inputs.

     

    In case you don't want to enforce the max length via that property, you can use the following code in the DisplayMode of the submit button (change to the correct control names):

    If(
     CountIf(
     Gallery1.AllItems,
     Len(TextInput1.Text) > 11 || Len(TextInput2.Text) > 5 || Len(TextInput3.Text) > 1
     ) > 0,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

     

    In case you don't use the MaxLength property, you may want to color the Text Input's border red when too many characters have been entered:

    //BorderColor property of TextInput1
    If(
     Len(Self.Text) > 11,
     Color.Red,
     RGBA(0,18,107,1)
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard