Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Button ONSELECT event not triggering correctly?

Like (1) ShareShare
ReportReport
Posted on 14 Jan 2025 12:41:15 by 10
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 14 Jan 2025 at 17:07:16
    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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,609

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,420

Leaderboard
Loading complete