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 / Button Is Immune to Di...
Power Apps
Answered

Button Is Immune to Disabling (Magic?!)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hey guys,

 

Sorry for the funny post title but serious issue:

I have a button that I want to disable based on some data in a form (fairly typical usecase I think- if fields are empty you can't submit). My problem is no matter what I do to this button, I can't get it to disable. It just... won't. I've had a variety of complex functions to check for various fields that I thought might be broken, but no.

 

I've boiled it all the way down to this. On the screen that the button is on I've set the OnVisible property to: Button3.DisplayMode.Disabled

 

And the button is still enabled. I've tried this same format in a dozen different places. It just... won't. I even put a button in that has that command. Nothing.

 

How is this not the right command and what am I doing wrong? I'm absolutely baffled here. The field just won't change.

Categories:
  • Verified answer
    Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    To disable the button you need to put something in the DisplayMode property of the button.  For example, if you have a TextInput1 use the following formula in the DisplayMode of the button to disable it when TextBox1 is empty.

    If(IsBlank(TextInput1.Text),DisplayMode.Disabled,DisplayMode.Edit)

     

  • C-Papa Profile Picture
    1,836 on at

    Hi, you shouldn't refer to the button in your code. the below works by looking for changes in your form that is different to the data source

     

    Set your button display mode to the below and change Form1 to your form name. 

    If(Form1.Unsaved,DisplayMode.Edit,Disabled)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks... Power Apps is very confusing to me coming from stuff like C#. I don't understand why I can't reference an object directly to adjust it's variables. Making a text box as a variable(!) is just baffling to me, but I appreciate the solution.

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    Its because C# is procedural and Power Apps is declarative.  You can't change the property of an object directly in code at runtime in Power Apps.  But you can change the value of a variable and have the property respond to that change.  For developers getting used to the non-procedural declarative form of the code is often a challenge.

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard