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 / label field validation...
Power Apps
Answered

label field validation within gallery item

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

i have a vertical gallery which contains multiple labels. Now the user requirement is to enter data through gallery only and not through a form which means i would want to edit the item in the gallery itself and save it. 
Now the user has said that the specified columns should be validated to have number value from 0-1 or MAT or PAT. if value is any other than these said values it should show an error and not allow to the user to submit the data.

Please find the image for my gallery below. Now the columns from Jan-Feb are labels and i would want to validate these before saving the data to sharepoint list.

 

Please help me validate this...

 

image.png

Categories:
  • eka24 Profile Picture
    20,925 on at

    Can explain MAT or PAT

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @eka24 it is just a text value that is all. also i have replaced my labels to text input now.

  • Verified answer
    eka24 Profile Picture
    20,925 on at

    Create a table the contains the various characters OnStart of the App or OnVisible:

    Set(CharacterTable,
    Table({Item: "1" }, { Item: "0"}, { Item: "PAT" },{Item: "MAT"}))

    Then:
    On the DiaplayMode of the Save Icon Or Edit Icon in the Gallery put:
    If(Label1.Text in Character.CharacterTable.Item,
    DisplayMode.Disabled,DisplayMode.Edit)
    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
     
     
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Do you want to validate each Text Input box value within your Gallery before saving data back to your data source?

     

    I have made a test on my side, please consider take a try with the following workaround:

    Set the OnSelect property of the "Save" icon within your Gallery to following:

    If(
     Sum(
     If(
     (Value(JanTextInputBox.Text)>=0 && Value(JanTextInputBox.Text)<=1) || JanTextInputBox.Text = "MAT" || JanTextInputBox.Text = "PAT"),
     0,
     1
     ),
     If(
     (Value(FebTextInputBox.Text)>=0 && Value(FebTextInputBox.Text)<=1) || JanTextInputBox.Text = "MAT" || JanTextInputBox.Text = "PAT"),
     0,
     1
     ),
     If(
     (Value(MarTextInputBox.Text)>=0 && Value(MarTextInputBox.Text)<=1) || JanTextInputBox.Text = "MAT" || JanTextInputBox.Text = "PAT"),
     0,
     1
     ),
     ...
     ...,
     If(
     (Value(DecTextInputBox.Text)>=0 && Value(DecTextInputBox.Text)<=1) || JanTextInputBox.Text = "MAT" || JanTextInputBox.Text = "PAT"),
     0,
     1
     )
     ) > 0,
     Notify("There is something with the enter value in these Text Boxes, the valid value is from 0-1 or MAT or PAT", NotificationType.Error),
     Patch( // Update the changes back to your data source using Patch function
     'Your Data Source',
     LookUp('Your Data Source', PrimaryColumn = ThisItem.PrimaryColumn),
     {
     Jan: JanTextInputBox.Text,
     Feb: FebTextInputBox.Text,
     Mar: MarTextInputBox.Text,
     ...
     ...,
     Dec: DecTextInputBox.Text
     }
     )
    )

    Note: The Jan, Feb, Mar, ... are all columns in your data source. Please replace it with actual column name from your data source.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-xida-msft i am getting an error in your code. i am trying to disable and enable my save icon rather than allowing user to save the data and then show the error. 
    Please find the code below;

    If(
     Sum(
     If(
     (Value(TextInput2.Text)>=0 && Value(TextInput2.Text)<=1) || TextInput2.Text = "MAT" || TextInput2.Text = "PAT"|| TextInput2.Text = "mat" || TextInput2.Text = "pat"),
     0,
     1
    ),
     If(
     (Value(TextInput4.Text)>=0 && Value(TextInput4.Text)<=1) || TextInput4.Text = "MAT" || TextInput4.Text = "PAT"|| TextInput4.Text = "mat" || TextInput4.Text = "pat"),
     0,
     1
     ),
     If(
     (Value(TextInput5.Text)>=0 && Value(TextInput5.Text)<=1) || TextInput5.Text = "MAT" || TextInput5.Text = "PAT"|| TextInput5.Text = "mat" || TextInput5.Text = "pat"),
     0,
     1
     ),
     
     If(
     (Value(TextInput6.Text)>=0 && Value(TextInput6.Text)<=1) || TextInput6.Text = "MAT" || TextInput6.Text = "PAT"|| TextInput6.Text = "mat" || TextInput6.Text = "pat"),
     0,
     1
     ),
     If(
     (Value(TextInput7.Text)>=0 && Value(TextInput7.Text)<=1) || TextInput7.Text = "MAT" || TextInput7.Text = "PAT"|| TextInput7.Text = "mat" || TextInput7.Text = "pat"),
     0,
     1
     ),
     If(
     (Value(TextInput8.Text)>=0 && Value(TextInput8.Text)<=1) || TextInput8.Text = "MAT" || TextInput8.Text = "PAT"|| TextInput8.Text = "mat" || TextInput8.Text = "pat"),
     0,
     1
     ),
     If(
     (Value(TextInput9.Text)>=0 && Value(TextInput9.Text)<=1) || TextInput9.Text = "MAT" || TextInput9.Text = "PAT"|| TextInput9.Text = "mat" || TextInput9.Text = "pat"),
     0,
     1
     ),
     If(
     (Value(TextInput10.Text)>=0 && Value(TextInput10.Text)<=1) || TextInput10.Text = "MAT" || TextInput10.Text = "PAT"|| TextInput10.Text = "mat" || TextInput10.Text = "pat"),
     0,
     1
     ),
     If(
     (Value(TextInput11.Text)>=0 && Value(TextInput11.Text)<=1) || TextInput11.Text = "MAT" || TextInput11.Text = "PAT"|| TextInput11.Text = "mat" || TextInput11.Text = "pat"),
     0,
     1
     ),
     If(
     (Value(TextInput12.Text)>=0 && Value(TextInput12.Text)<=1) || TextInput12.Text = "MAT" || TextInput12.Text = "PAT"|| TextInput12.Text = "mat" || TextInput12.Text = "pat"),
     0,
     1
     ),
     If(
     (Value(TextInput13.Text)>=0 && Value(TextInput13.Text)<=1) || TextInput13.Text = "MAT" || TextInput13.Text = "PAT"|| TextInput13.Text = "mat" || TextInput13.Text = "pat"),
     0,
     1
     ),
     If(
     (Value(TextInput15.Text)>=0 && Value(TextInput15.Text)<=1) || TextInput15.Text = "MAT" || TextInput15.Text = "PAT" || TextInput15.Text = "mat" || TextInput15.Text = "pat") ,
     0,
     1
     )
     ) > 0,DisplayMode.Edit,DisplayMode.Disabled)

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 350 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 318

#3
Mohsin Ali Profile Picture

Mohsin Ali 220

Last 30 days Overall leaderboard