cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

label field validation within gallery item

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: label field validation within gallery item

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.
 
 

View solution in original post

5 REPLIES 5
Highlighted
Community Champion
Community Champion

Re: label field validation within gallery item

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.

Highlighted
Post Patron
Post Patron

Re: label field validation within gallery item

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

Highlighted
Community Champion
Community Champion

Re: label field validation within gallery item

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.
 
 

View solution in original post

Highlighted
Community Support
Community Support

Re: label field validation within gallery item

Hi @jayant1 ,

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 Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Patron
Post Patron

Re: label field validation within gallery item

@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)

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,740)