cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FreddieV
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.

 

issue.png

 

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.

3 REPLIES 3
GarethPrisk
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).

@GarethPrisk 

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!

Anonymous
Not applicable

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

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,846)