cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
praneethapradee
Frequent Visitor

When I press one button of the two buttons, disable both the buttons.

Hey @nickduxfield 

 

I think you can help me solve my issue regarding disabling buttons.

I have a screen which has 2 buttons:

AcceptButton and RejectButton [I have attached the scrren below]

When the customer is using this screen,

eg: If he clicks on AcceptButton the first time,the AcceptButton and RejectButton should be disabled and in the same case if he clicks on RejectButton the first time, the rejectbtton and acceptbutton should be disabled... he can only go back by presseing GO BACK button below.

 

Please help!

Thank you.button.PNG

4 REPLIES 4
Anonymous
Not applicable

In the OnSelect property for your Accept and Reject buttons use an UpdateContext to set a variable to true, use the same variable for both buttons. 

 

UpdateContext({buttons_off: true})

 

Then in the OnSelect property for your GOBACK button add:

 

UpdateContext({buttons_off: false})

 

Now set your DisplayMode property  in both your accept and reject buttons to use the variable, buttons_off.

If(buttons_off, DisplayMode.View, DisplayMode.Edit)

Hey thanks for the reply:

 

As you instructed:

 

on select property: I have done the same thing for reject button as well.

onselect.PNG

Go back button on select property: 

goback.PNG

Im getting an error in Displaymode:

displaymode.PNG

 

What do I need to do?

 

Thanks.

Anonymous
Not applicable

Each button has it's own OnSelect. Do it like this:

For Accept button OnSelect

 

 

UpdateContext({buttons_off: true});

Patch(Your patch commands....

 

 

Then do the same for your Reject button's OnSelect.

 

Thenfor your Go Back button OnSelect:

 

 

UpdateContext({buttons_off: false});

Navigate(LoginScreen, Fade)

 

 

Now, for your Accept button's DisplayMode:

 

 

If(buttons_off, DisplayMode.View, DisplayMode.Edit)

 

 

Do the same for your Reject button.

 

That should do it. Your syntax with UpDate({AcceptButton: false, RejectButton: False...... is very wrong. That's where the errors are coming from. 

nickduxfield
Responsive Resident
Responsive Resident

If he clicks on AcceptButton the first time

in addition to your action to your database to confirm accept/reject you need to add this to the button properties. 

AcceptButton.onselect =

UpdateContext({varActionButtons:false})

,the AcceptButton and RejectButton should be disabled and in the same case

AcceptButton & RejectButton .visibility field set to the contect variable varActionButton 
When any button is selected it toggles variable between true false.
The .visibility field toggles visibility using true/false.

he can only go back by pressing GO BACK button below. (back meaning unlock buttons, not navigation)

UpdateContext({varActionButton:true})

 

 

Go back can unlock the accept/reject controls allowing another choice, and when unlocked,

could double as a navigate away to another screen. based on a safety dialogue box with a 

'are you sure you want to go back?'

GoBack Button

Switch(varActionButtons,
true,UpdateContext({varActionButtons:false,varBackDialogueBox:true})
/*If pressed while action buttons visible, it means go back*/
,false,UpdateContext({varActionButtons:true}))
/*If pressed while action buttons are hidden, they become visible and active.

Dialogue box YES Button

UpdateContext({varActionButtons:false,varBackDialogueBox:false});Back()

 No

UpdateContext({varActionButtons:true,varBackDialogueBox:false})

 

I trust you understand the concept,

further questions can be asked

 

 

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,548)