cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
drallam2
Level: Powered On

Disabling buttons when pressed

Hi,

 

I have scenario where I have  Start,Stop and Submit Buttons. I want to disable the both Start and Submit button once the Start button it's pressed, so that the user only selects the Stop button and once it's pressed the Submit button enables and once Submit button is pressed Start button enables. 

 

I'm using the Button.Pressed property button but couldn't make it what i need to do. 

 

I would appreciate any input or any workaround.

 

thanks!! 

1 ACCEPTED SOLUTION

Accepted Solutions
nickduxfield
Level 8

Re: Disabling buttons when pressed

I want to disable the both Start and Submit button once the Start button it's pressed,

UpdateContext({ButtonVisible:true})

 

StartButton Visible Property | ButtonVisible

DubmitButton Visible Property | ButtonVisible

StopButton Visible Property | true

 

Screen OnVisible | UpdateContext({ButtonVisible:true}) If you want the buttons to be visible when you return to screen.

 

StartButton OnSelect Property | UpdateContext({ButtonVisible:false}) //not visible if pressed, otherwise visible

DubmitButton OnSelect Property | UpdateContext({ButtonVisible:false}) //not visible if pressed, otherwise visible

StopButton OnSelect Property | UpdateContext({ButtonVisible:true}) //enables visiblity of start and submit, stop always remains visible

 

so that the user only selects the Stop button and once it's pressed the Submit button enables and once Submit button is pressed Start button enables. 

 

Amend your code etc: UpdateContext({ButtonVisible:false,StartTimer: true, InitialTime: Now() });Collect(DataCollection,{StartTime:Text(InitialTime,"[$-en-US]mm/dd/yyyy hh:mm:ss"),Title:User().FullName})

 

You dont need a complex if statement at this point.

You also dont need an OnVisible, it depends on screen switching or how much control you need.

View solution in original post

12 REPLIES 12
nickduxfield
Level 8

Re: Disabling buttons when pressed

Set a variable for each button you want disabled on visible.

example: UpdateContext({StopButtonVisible:true,SubmitButtonVisible:true})

 

Now head to each of the relevant buttons and add similar to OnSelect.

UpdateContext({StopButtonVisible:false,SubmitButtonVisible:false})

 

Now add StopButtonVisible & SubmitButtonVisible to the respective button's visible property....

 

Let us know if you get the concept

drallam2
Level: Powered On

Re: Disabling buttons when pressed

I didnot get the idea. So when you mean updating the context to OnSelect for a StartButton the formula would be  UpdateContext({StopButton.Visible=false,SubmitButton.Visible=false})?

 

and the viceversa with Stop and Submit buttons?

 

I was dong it with the Displaymode.Disabled based on a StartTimer status in an IF statement. But doesn't work 3 ways.

nickduxfield
Level 8

Re: Disabling buttons when pressed

Your getting the idea.

Take your Visibile: true or false on all advanced section of controls, Cards and other.

Capture.JPG

Instread of true, we can replace with a variable where StartButtonVisible is the variable

If you can create a formula to toggle a variable to true or false where StartButtonVisible is the variable.

Then the variable will equal true or false, changing the visibility of the control...

 

I can use the OnSelect of a button to toggle the variable

Capture.JPG

Then i will put the variable in the visible field of another control that I'm targeting.

Capture.JPG

If you need to keep the variable over multiple screens you need a Global variable. You have to crete that OnStart. See the first screen of the app.

Capture.JPG

 

drallam2
Level: Powered On

Re: Disabling buttons when pressed

So,

 

This is what I have as the formula for OnStart command in the Start button 

UpdateContext({StartTimer: true, InitialTime: Now() });Collect(DataCollection,{StartTime:Text(InitialTime,"[$-en-US]mm/dd/yyyy hh:mm:ss"),Title:User().FullName})

 

This the formula for OnStart command in the Stop Button

UpdateContext({StartTimer: false, CurrentTime: Now() });Collect(DataCollection,{EndTime:Text(CurrentTime,"[$-en-US]mm/dd/yyyy hh:mm:ss"),Title:User().FullName});'Start Button'.DisplayMode.Disabled=Disabled

 

So per your direction. I will add StartButtonVisible as a variable in the Visible field for the Start button, which is disappearing the button.

But my question is where do i give the if statement, for the Stopbutton may be in the OnSelect command? If so what would the statement look like. I'm just not able to get a head around this one.

 

Thanks for your input.

 

nickduxfield
Level 8

Re: Disabling buttons when pressed

I want to disable the both Start and Submit button once the Start button it's pressed,

UpdateContext({ButtonVisible:true})

 

StartButton Visible Property | ButtonVisible

DubmitButton Visible Property | ButtonVisible

StopButton Visible Property | true

 

Screen OnVisible | UpdateContext({ButtonVisible:true}) If you want the buttons to be visible when you return to screen.

 

StartButton OnSelect Property | UpdateContext({ButtonVisible:false}) //not visible if pressed, otherwise visible

DubmitButton OnSelect Property | UpdateContext({ButtonVisible:false}) //not visible if pressed, otherwise visible

StopButton OnSelect Property | UpdateContext({ButtonVisible:true}) //enables visiblity of start and submit, stop always remains visible

 

so that the user only selects the Stop button and once it's pressed the Submit button enables and once Submit button is pressed Start button enables. 

 

Amend your code etc: UpdateContext({ButtonVisible:false,StartTimer: true, InitialTime: Now() });Collect(DataCollection,{StartTime:Text(InitialTime,"[$-en-US]mm/dd/yyyy hh:mm:ss"),Title:User().FullName})

 

You dont need a complex if statement at this point.

You also dont need an OnVisible, it depends on screen switching or how much control you need.

View solution in original post

drallam2
Level: Powered On

Re: Disabling buttons when pressed

HI,

 

I tried your solution and I'm still not able it cycle it through all the three.

Eg: User will just see Start initially in the screen

       Clicks Start Button it disappears and Stop Button Shows up.

       Clicks Stop Button it disappears and Submit Button Shows up.

       Clicks Submit Button it disappears and Start Button Shows up.

Is it possible this way? 

 

Thanks for being patient.

 

 

 

nickduxfield
Level 8

Re: Disabling buttons when pressed

Hey @drallam2, I created a video for you. I hope this will help yoiu understand the buttons better.

How to setup Buttons

drallam2
Level: Powered On

Re: Disabling buttons when pressed

I cannot find the video 😞

nickduxfield
Level 8

Re: Disabling buttons when pressed

The link expired in 2 days

This one is 30

https://1drv.ms/v/s!Arv8RHb9f9PthvshdpVlq6NH1O1afw

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,759)