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

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,332)