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

In Gallery, Validate on control based on another control.

In a gallery (galItems), there is a dropdownlist (ddlStatus) for Status (Pass, Fail, Ignore), and a textbox (txtComments) field. If the Status="Fail", the Comments field cannot be blank. 


What is the PowerApps way to implement this validation when a Save button is selected?


This page doesn't really provide enough information nor good examples: Validate function in Power Apps - Power Apps | Microsoft Docs

Super User
Super User

You can't actually 'require' fields in Power Apps.    What you can do is a workaround.    I am going to give an example that presumes your save button is in the individual gallery item.


Add a 10 x 10 label with an Asterisk in it (red color) and put it to the right or left of your comment field in the gallery.   Set it's visible property to:

ddlStatus.selected.XXX = "Fail" && IsBlank(txtComments)


Follow the same logic and set the displaymode property of the save button to view.


  ddlStatus.Selected.XXX = "Fail" && IsBlank(txtComments), DisplayMode.View, DisplayMode.Edit


If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
Community Support
Community Support


Do you want to validate the status and comments field when you submit?

Could you please share a bit more about your scenario?


Firstly, you should put a validation within the Comments field by setting the HintText text input as below:

If(ddlStatus.Selected.Value="Fail"&& IsBlank(TextInput1.Text),"Here should have inputs!","")

Set the save button OnSelect property as below:

If(!IsBlank(TextInput1.HintText),Notify("Comments field cannot be blank, please fill in!",Error))
Best Regards,
Helper I
Helper I

Here's what I did...


In txtComments.Fill: 
If(ddlResult.Selected.Value = "At Risk" && IsBlank(txtComments),
RGBA(255, 0, 0, 1),
RGBA(255, 255, 255, 1)


In btnSubmit.OnSelect: 


Notify("At Risk items must have a comment. Please update " & varValidationCnt & " row(s)"),
If(CountRows(colObsItems) > 0,
Patch('MySharePointListName', colObsItems);
Notify(CountRows(colObsItems) &
" detail item(s) were saved", NotificationType.Information);

Helpful resources

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,810)