Greetings,
I'm having an issue with trying to make a button become disabled after it's been pressed once. I tried following the solution in this post but it simply doesn't work. I get "error token" under the button's name in the OnSelect field. I feel like the way one disables a control changed since then.
What I need is once the button was pressed, run a process which works and then disable itself. Right now it runs fine, but the disabling part doesn't work...it keeps the button up there.
Any help is greatly appreciated!
It worked for me but not using the function Updatecontext({key: value}) else creating a variable statusDisplay and setting this using Set() function when the App Start:
Set(statusDisplay;DisplayMode.Edit)
After I set the Display Mode (Button property) with StatusDisplay variable:
I set OnSelect on the Button to:
Set(statusDisplay;DisplayMode.Disabled)
And voilà !!!!
Many Thanks Jason!!!
Good morning. In my case I solved the problem by applying a variable and a collection. I explain it.
This Button is on a Gallery. I have created on property OnStart of the page Clear (DisaButton);;
Set(
DisableButton;
false
)
Then in Onselect of the button I apply
Set(
DisableButton;
true
);;
Collect(
DisaButton;
ThisItem.'Name (field_2)'
)
and finally to the DisplayMode property of the button I apply
If(
ThisItem.'Name (field_2)' in DisaButton;
DisplayMode.Disabled;
DisplayMode.Edit).
When you click the button it is deactivated.
Now what I would like to do is when the page loads this button is disabled if the record is already in the sharepoint list. I've tried several options, but it just doesn't work. Does anyone have any ideas?
Did you ever find a fix for this? I've just come up against the same problem!
The Same issue I got where I've a list if I disable the button on one item, it does hold the state for other items too.
I need to click on the button which is like 'save' against the item then it should disable or hide the save button and the second button should be visible on the same spot which is an 'update' button but I've tried all ways couldn't figure out. Seems like it's a bug in powerapps because I have achieved same kind of logic in Macros.
Thanks @Jason_Hough, I realise your solution was posted a while ago now but hoped you could help me - I am trying to integrate your solution into my project however I am not quite sure what to do with the code currently driving the DisplayMode on the button.
i.e. requirements...
Previously I had:
SendChaseButton.DisplayMode
If(ThisItem.DueDate<TimeNow,DisplayMode.Edit,DisplayMode.Disabled)
SendChaseButton.OnSelect
PowerAppsbutton.Run(ThisItem.ID);SendChaseButton.DisplayMode=DisplayMode.Disabled #<-- Doesn't work
I updated the code to use a context variable as you recommended:
SendChaseButton.DisplayMode
ButtonStatus
SendChaseButton.OnSelect
PowerAppsbutton.Run(ThisItem.ID);UpdateContext({ButtonStatus:DisplayMode.Disabled})
... however, while this does now disable the button when the user clicks it, it no longer sets it's initial status -- I tried to incorporate the context variable with my previous If statement, however it would not accept this syntax.
Any help you can give me would be grately appreciated!
Ok, it looks like you're using updatecontext to enable the button.
Simpler solution:-
Set(EnableAddPhotos, true)
And then change the DisplayMode property of your add photos button to 'EnableAddPhotos'.
You'll want to also initially set that variable to false, which you could do in the OnVisible for your page.
let me know what the issue is, as i have an app that does kind of what you are reffering to
Lost of activity in this topic!!
I wish we can find someone who can solve the issue of saving pictures and retrieven in a share point list
😞
Aw, I just saw your reply come in as I was explaining how to do it - I'll stop typing!
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
mmbr1606
275
Super User 2025 Season 1