Skip to main content

How to Disable a Button Until a Text Box Has Text in Power Apps

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

A Send button shouldn't work while there's nothing to send. Set its DisplayMode to Disabled while the text box is empty, and while the save is running, so it can't be pressed twice.

Prerequisites​

The Formula​

In the Career Development Plan app, the Send button on the Response screen uses:

btnSendRS → DisplayMode
If(locIsSaving || IsBlank(Trim(txtResponseRS.Text)), DisplayMode.Disabled, DisplayMode.Edit)

With text in the box, the preview strip shows the result, edit:

The formula bar with the DisplayMode formula of btnSendRS selected and the preview strip reading = edit with Data type text

The Result​

With the box empty, the button is greyed out and can't be selected:

The Response screen in preview with an empty text box, 0 of 4,000 characters, and a greyed-out Send to manager button

As soon as there's text, it's enabled:

The same screen with a paragraph typed, 247 of 4,000 characters, and the Send to manager button enabled in the theme color

The text box's TriggerOutput is Keypress by default, so the button turns on with the first character.

Common Mistakes​

MistakeWhat happensDo this instead
IsBlank(txtX.Text) without TrimA box of spaces enables the buttonWrap the text in Trim(…)
Hiding the button insteadPeople don't know what's missingDisable it, and keep it visible
No saving flagA double press can save twiceDisable while locIsSaving is true

Troubleshooting​

SymptomLikely causeFix
The button stays disabled after a failed saveThe saving flag wasn't clearedSet it back to false in the error branch too
It enables only after leaving the boxTriggerOutput isn't KeypressSet it to TriggerOutput.Keypress

FAQ​

What's the difference between Disabled and View?​

Disabled greys a control out; View shows it read-only (How to Make a Control Read-Only in Power Apps with DisplayMode).

Should the button also explain why it's disabled?​

A visible hint helps. In the example, the instruction above the box says what to write.

Conclusion​

Set the button's DisplayMode to If(locIsSaving || IsBlank(Trim(txtX.Text)), DisplayMode.Disabled, DisplayMode.Edit). Empty boxes and running saves both keep it off.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.