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 / Disable button if cond...
Power Apps
Answered

Disable button if condition not met for all textboxes

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I am trying to provide a sign-off capability for my managers so that they can provide a sign off in one click for all the items that fall under their purview. The entry of the data in the textboxes is based on multiple conditions and if any condition fails, it provides an error message for that item. Now the Managers should only be able to provide a sign-off if all the items are error free i.e. the error box is empty/blank. 

 

Currently, the managers are able to click on the button even is one error box is blank while others may still have errors. And the sign-off is flagged as yes for all the items under them. I want that the button should be disabled, until and unless the errors from all the items are removed or taken care of. 

 

The formula I am using is : If(
!IsBlank(DatePicker.SelectedDate) && IsBlank(ErrorMsglbl.Text) && !IsBlank(Input_comments.Text) && !IsBlank(Dropdown.Selected.Value),UpdateIf('New Projects',User().Email in 'GM email id',{'Sign off status': "Yes"}),Notify("The data is invalid to sign-off on the projects",NotificationType.Error))

 

Please provide some guidance/help on this matter. What can I change in the formula?

Categories:
  • Loose Chippings Profile Picture
    185 on at

    Hi @tapastiwari

     

    One way to achieve this would be to make your sign off button invisible until all the conditions are met.  So in the Visible property of the button, put a similar If statement to the one you have written: 

    If( !IsBlank(DatePicker.SelectedDate)

    && IsBlank(ErrorMsglbl.Text)

    && !IsBlank(Input_comments.Text)

    && !IsBlank(Dropdown.Selected.Value, true, false)

     

    So the sign off button will only be visible if there is a Date, no Error Message, a Comment and a choice from your Dropdown.  

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @LooseChippings

     

    Thanks for your help! 

     

    The button becomes visible even if the error is cleared from one item, and the manager is then able to sign-off on all, including the ones with errors. Is there a way we can limit the visibility of the button, so that it becomes visible only after all the items are clear of the error message? 

     

    Regards,

    Tapas

  • Loose Chippings Profile Picture
    185 on at

    Hi @tapastiwari 

     

    Yes, there is.  With an If statement, you can use '&&' or you can use '||'.  && means 'AND' , (so Red && Green means "red AND green") .  || means 'OR', (so "red OR green"). 

     

    It is sometimes confusing to get the right logic when using AND/OR, but in your case, changing the && to || means the button will remain invisible "If the Date Picker is blank OR the Error Message has text, OR the Comments are blank OR the Dropdown is not selected", which is what I think you need.

     

    The symbol '|' is called a Pipe and is found by pressing [Shift \].

  • vaibhavtandon87 Profile Picture
    182 on at

    I think Tapas is referring to list of gallery items @LooseChippings instead of 1 single item. Is there a way to implement it for a list of items in gallery?

     

     

  • Loose Chippings Profile Picture
    185 on at

    Hi @vaibhavtandon87 

     

    Yes, you can add a button to a gallery and use the same principal of a series conditions inside the IF statement. The main difference will be the reference to the input fields.  So Tapas' case, the reference would be something like:

    If( !IsBlank(ThisItem.DatePicker.SelectedDate)

    || IsBlank(ThisItem.ErrorMsglbl.Text)

    || !IsBlank(ThisItem.Input_comments.Text)

    || !IsBlank(ThisItem.Dropdown.Selected.Value, true, false)

     

    You may (almost certainly) only want the button to show up on the selected row of the gallery.  In this case add an extra condition to the Visible property of the button:
    If( ThisItem.IsSelected,
    && !IsBlank(ThisItem.DatePicker.SelectedDate)

    || IsBlank(ThisItem.ErrorMsglbl.Text)

    || !IsBlank(ThisItem.Input_comments.Text)

    || !IsBlank(ThisItem.Dropdown.Selected.Value, true, false)

  • vaibhavtandon87 Profile Picture
    182 on at

    Thanks for the reply!

     

    @LooseChippings One button to be only 'enabled and be able to save' 'all' the items when all the 'conditions' are met. Else even if 1 row out of 10 etc rows in the gallery dont meet the criteria then button should not be enabled.

     

    Currently the button only works successfully for first item when the criteria is not met else it gets enabled.

  • vaibhavtandon87 Profile Picture
    182 on at

    For clarification - I and him are working on the same problem statement

  • pawanjajoo Profile Picture
    191 on at

    Hi @vaibhavtandon87 & @tapastiwari ,

     

    Can you please place the formula provided by @LooseChippings as a text property of a label and see the results? Share the screenshot on what you see when using the formula provided by @LooseChippings .

  • Loose Chippings Profile Picture
    185 on at

    Hi @vaibhavtandon87 

     

    So, you have a gallery with many rows (say 20).  What I have suggested should show a button only in the selected row if all the conditions are met in that row.  After re-reading the original post, I think you are asking for one button to submit all the rows where the conditions are being met.

     

    A basic PowerApp is normally set up to have a Gallery showing many items.  You select an item and it populates a Form with the details of the item.  There would then be a button on the form to submit the form back to the data source.

     

    What you would like is possible but rather complicated.  You could have a button not in the gallery and use a ForAll() and Patch() statement, with the If() statement, in order to run through all the items in the gallery which meet your criteria.  There is a Shane Young @Shanescows video here https://www.youtube.com/watch?v=0xZ4fMJbLvk which covers this subject.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @pawanjajoo & @LooseChippings ,

     

    Thank you so much for all your help on this. 

     

    I think @LooseChippings has understood the issue correctly. We want one single button to provide 'Sign-off' to multiple items in the gallery based on conditions in each of the row, as determined by the formula shared by @LooseChippings . What we are seeing in the app after applying that is : 

     

    tapastiwari_0-1596829630971.png

    This should be the ideal condition when there is no error, and the signoff button is enabled.

    tapastiwari_1-1596829681847.png

    This is what we are getting, there is an error in the item, but the item is still enabled. 

     

    We will go through the video link shared and will check if we are able to get it to work for us. 

     

    Once again, thanks a lot for your help on this, really appreciate it.

     

    Regards,

    Tapas 

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard