cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Validation on Text Input field inside a galley control

Hi,

 

I have an app where I have added a gallery control and inside the gallery I have added few text boxes. I want to apply mandatory field validation on these text boxes (for each row of gallery control). I want to run this validation the click of "Save" button.

Can some one please tell me how can I achieve that?

Note: Screenshot attached of my app.

 

Thanks

Saksham

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @sakshamgupta01 ,

 

Try to put the following code to App.OnStart property and the OnChange property of TextInput1 and TextInput2 inside the gallery.

 

Clear(BlankField);ForAll(Gallery2.AllItems, If(IsBlank(TextInput1.Text)|| IsBlank(TextInput2.Text),Collect(BlankField, true)));

 

Then, set the DisplayMode property of Save button as follows:

 

If(true in BlankField,DisplayMode.Disabled,DisplayMode.Edit)

 

 

Save Button is enabled only when all text boxes 1 and 2 in the gallery are filled in.

Hope this helps.

Sik

 

View solution in original post

5 REPLIES 5
Super User III
Super User III

Your information on what control you want to validate is not clear but try;

On the displaymode of the button:

If(IsBlank(Textbox1.Text) Or Dropdown1.Selected=IsBlank (), DisplayMode.Didabled,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.

Hi,

 

This didn't worked for me, as I want to enable the save button when all rows inside gallery control has a value else save button should be disabled.

 

Thanks

Saksham

What are the names of your controls and how many are they. The structure of the formula I gave is ok. Jus give the names.

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

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 Support
Community Support

Hi @sakshamgupta01 ,

 

Try to put the following code to App.OnStart property and the OnChange property of TextInput1 and TextInput2 inside the gallery.

 

Clear(BlankField);ForAll(Gallery2.AllItems, If(IsBlank(TextInput1.Text)|| IsBlank(TextInput2.Text),Collect(BlankField, true)));

 

Then, set the DisplayMode property of Save button as follows:

 

If(true in BlankField,DisplayMode.Disabled,DisplayMode.Edit)

 

 

Save Button is enabled only when all text boxes 1 and 2 in the gallery are filled in.

Hope this helps.

Sik

 

View solution in original post

Thanks, this works perfectly fine ! 😊

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (45,674)