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 Apps
Unanswered

Buttons visibility

(0) ShareShare
ReportReport
Posted on by

Hello, I have two buttons. One to add, the other to cancel. I would like the cancel button to appear after clicking add, and at the same time the add button should disappear, and vice versa, if I click cancel, cancel disappears and add appears.

 

So far, I've been doing it this way: I set a variable in the Visibility of the add button

addVis

and a variable in the cancel button

cancVis

in the on select add button

UpdateContext({addVis:false});;
UpdateContext({cancVis:!cancVis});;

in the on select cancel button

UpdateContext({cancVis:false});;
UpdateContext({addVis:!addVis});;

 

but there is some mix-up of buttons after starting

 

Categories:
  • SpongYe Profile Picture
    5,909 Super User 2026 Season 2 on at

    Hi @pablik01 

     

    In the Onvisible of the screen can you add this:

    UpdateContext({addVis:true});;
    UpdateContext({cancVis:false});;

    SpongYe_0-1697749775988.png

    You are doing it correctly but the UpdateContext starts as Blank so you need to set that first.

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

     

  • SpongYe Profile Picture
    5,909 Super User 2026 Season 2 on at

    Hi @pablik01 

     

    In the Onvisible of the screen can you add this:

    UpdateContext({addVis:true});;
    UpdateContext({cancVis:false});;

    SpongYe_0-1697749775988.png

    You are doing it correctly but the UpdateContext starts as Blank so you need to set that first.

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

     

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @pablik01 , 

    At first sight the code should do the trick.  😊

     

    Make sure you define a start value for the Add button in the Screen OnVisible property otherwise the start values of those variables will be blank (returning false).

    //Screen OnVisible
    UpdateContext({addVis:true})

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Michael E. Gernaey Profile Picture
    53,970 Super User 2026 Season 2 on at

    Hi @pablik01 

     

    I believe the issue is by default those variables will not have values so it throws it off.

     

    Option 1

    So you have to either use the App.OnStart to set the values properly first, aka if you want Add visible first, then I would set that variable to true, and your Cancel to false.

     

    Option 2

    There is another option you can do also. This would make it so you dont need to use Global Variables, as you would in the previous option

     

    In your App.OnStart, add a Variable like this

    Set(FirstTimeRun, true);

     

    Now, in the OnVisible property of the Form

    If(FirstTimeRun,
     UpdateContext({cancVis:false});
     UpdateContext({addVis:true});
     Set(FirstTimeRun, false);
    )

    this way you can set the values, initially and it should work going forward.


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • pablik01 Profile Picture
    on at

    so simple... Thank you

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard