Showing results for 
Search instead for 
Did you mean: 
Resolver I
Resolver I

Enable/Disable button outside of gallery on gallery item select?

So I have a PowerApp with a gallery that people search, and then click on records/items in order to edit them within a form.




Once they select the icon in the gallery (circled in red) I want the Submit button to be clickable, but for it to be greyed out/disabled on form load. Can this be done? All the edit buttons I am seeing sit within the Gallery, so the formulas offered don't make any sense.

I have already tweaked the app not to use the top gallery item as the selected item.

Resident Rockstar
Resident Rockstar

Simplest approach would be to use a variable.

UpdateContext({locEnableSubmit: false});

Then, when appropriate (like when clicking a Gallery button) toggle it to true:

UpdateContext({locEnableSubmit: true});


The advantages of a Boolean variable like this is the simplicity in evaluating and setting it.

On your button, you could do

If(locEnableSubmit, DisplayMode.Edit, DisplayMode.Disabled)


You can also always have other actions (like OnHidden of screen, or click of another button, reset the Boolean to false).


Thanks for the reply! I had read that using the context variable would be a good way to solve this. Your explanation helped a lot, although I am unsure what properties to assign the false part to? Like I I am updating the variable to true on Click of a gallery button, where do I assign the flase part?


Also, I've seen others name variables 'loc' - what does it stand for and why loc?


Many thanks!

New Member

I am also  Facing the similar issue , I gave UpdateContext({VarTriggerButton:True}) on the Onchange Property of Text Input field(Parent Gallery) and Placed an Invisible button in the Nested Gallery and  Onselect Property of tht button I gave If(VarTriggerButton, Updateif Condition) the Variable is returning true but its not able to Patch at the backend

(Update if Condition works on the onselect property of the btn without if condition)

Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.


New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,463)