Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Button ONSELECT event not triggering correctly?

(1) ShareShare
ReportReport
Posted on by 12
Hi, 
 
I have a button that executes the following:      Button click > Automate Flow > SQL stored proc > SQL Agent Job > does some stuff on some on prem servers.
 
Nothing is returned, its just a click and go for the user.  
 
I just want to stop the user from constantly pressing the button, just to click once.
 
I have tried, visible onselect = false.
 
display mode = disabled
 
and even a container that sits in front of the button.
 
Nothing seems to work.
 
Just wondering what someone else would do in this scenario?
 
 
 
Categories:
  • Suggested answer
    tmoore1 Profile Picture
    tmoore1 23 on at
    Button ONSELECT event not triggering correctly?
    Create a variable ('varBtnClick') that initializes with the app 'OnStart', or when the main screen appears 'OnVisible', or a gallery item is selected 'OnSelect', or some other trigger, and set its value to 'false'.
     
    Set(varBtnClick, false);
     
    At the top of the OnSelect parameter of your button, set the variable to 'true'.
     
    Set(varBtnClick, true);
    The rest of your button logic goes here;
     
    In either the 'Visible' or 'DisplayMode' parameter of the button, use an 'If' statement to change its value based on the variable.
     
    // Visible
    If(!varBtnClick, true, false)
     
    // DisplayMode
    If(
        !varBtnClick,
        DisplayMode.Edit,
        DisplayMode.Disabled
    )

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard