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 / The opposite of the On...
Power Apps
Answered

The opposite of the OnSelect() method

(0) ShareShare
ReportReport
Posted on by 418

Hi,

 

My issue is I want to disable a button if the user has entered a text field and then re-enable it once the focus is changed.  In the OnSelect() method I can set the Mode of the button but there is the lack of the opposite of the OnSelect() method to reneable the button.  

 

I tried putting the code in the OnChange() method.  The start of the OnChange() method disables the button and the very last bit of code re-enables the button.  However if the user is in the text field and changes some value, and then clicks the button without clicking anywhere else on the app, the onChange() method is not being executed before the button code which I need it to do.  

 

How can I achieve this?

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @samuelJ 

    I would suggest using this code in the DisplayMode property of your button

     

    If(IsBlank(TextInput.Text), Disabled, Edit);

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • SJ-15052312-0 Profile Picture
    418 on at

    Hi @mdevaney , 

    Thanks for your reply.  The code I have in the onselect is much more than just checking if a text box is blank or not. 

     

    There are X number of text boxes.  The user can have them blank or filled in.  What is really important is if the user changed the value of what is in the textbox(s).

     

    Something that would really save my day is having functionality around when focus is gained and focus is lost for a text box.  (onSelct & onDeSelct or something).

  • mdevaney Profile Picture
    29,993 Moderator on at

    @samuelJ 

    Sorry, there is not any ability in PowerApps to detect what control is focused on.  I suggest you create a new Idea for it. https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • SJ-15052312-0 Profile Picture
    418 on at

    Ok, well thank you for your time!  I will probably create an idea or see if one already exists. 

     

    I do hope somene in the community has a possible workaround or has done something similar though.  

  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at

    @samuelJ 

    There was only 1 idea I could find and unfortunately it has only 1 vote.  However, your vote will double that and I can upvote it for you too.  https://powerusers.microsoft.com/t5/PowerApps-Ideas/OnFocus-Property/idi-p/247636

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard