cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Reset Checkboxes in Gallery

Hello, 

 

Scenario

  • Gallery embedded (hacked!) into a Form
    • Extended one card height
    • Insert/Gallery
    • Changed Data Source for Gallery
  • Checkbox on each Gallery item
  • The boxes which are checked are collected and used to show/hide labels and input boxes lower down the form

 

Issue

  • When Cancel button is clicked on Form, the checkboxes inside the Gallery remain checked
    • ResetForm(<form_name>);Clear(<checkbox_collection>);Back()

 

Question

  • How do I clear the checkboxes in the Gallery so that the User is presented with a clean slate upon opening the app each time? 

 

Thank you very much!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Anonymous
Not applicable

Re: Reset Checkboxes in Gallery

Hi @ericonline

 

There is another way using context variables.

 

In the Checkbox.Reset add a context variable.

Example:

2.png

 

 

Now next to your ResetForm();

Add this code:

UpdateContext({ResetCheckbox:true});
UpdateContext({ResetCheckbox:false})

This will clear all checkboxes in Gallery when the form Resets.

 

 

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Re: Reset Checkboxes in Gallery

Hi @ericonline

 

You can use

Reset(Checkbox_Name);

This will reset your checkbox to the default. Put it next to ResetForm() so it happens at the same time.

Super User
Super User

Re: Reset Checkboxes in Gallery

Hi MartynasJurkus, 

 

Thank you for responding. 

 

Unfortunately, this did not work: 

  • ResetForm(<form_name>);Reset(<checkbox_name>);Clear(<checkbox_collection>);Back()

Just to reiterate, this is a Checkbox within a Gallery. Reading the Reset docs it does say "You cannot reset controls that are within a Gallery or Edit form control from outside those controls....". I'm looking for another method. 

Highlighted
Anonymous
Not applicable

Re: Reset Checkboxes in Gallery

Hi @ericonline

 

There is another way using context variables.

 

In the Checkbox.Reset add a context variable.

Example:

2.png

 

 

Now next to your ResetForm();

Add this code:

UpdateContext({ResetCheckbox:true});
UpdateContext({ResetCheckbox:false})

This will clear all checkboxes in Gallery when the form Resets.

 

 

View solution in original post

Super User
Super User

Re: Reset Checkboxes in Gallery

Nice solution! Thank you very much for your time and expertise. 

victore
Level: Powered On

Re: Reset Checkboxes in Gallery

Thanks a million.  I also had the checkbox inside the Gallery and I had an X button icon that I put there in case the user decided not to attach any file he/she just X-out and the checkboxes should have been cleared out and that what you advice did.  I tried your advice before but I just typed this formula: UpdateContext({ResetCheckbox:true}).  The second type I read your blog I type UpdateContext({ResetCheckbox:true});
UpdateContext({ResetCheckbox:false})

and it worked... Thanks!

victore
Level: Powered On

Re: Reset Checkboxes in Gallery

Thanks a million. 

I also had the checkbox inside the Gallery and I had an X button icon that I put there in case the user decided not to attach any file he/she just X-out and the checkboxes should have been cleared out and that what your advice did.  I tried your advice before but I just typed this formula: UpdateContext({ResetCheckbox:true}).  The second time I read your blog I typed both formulas on the onSelect property of the X button: UpdateContext({ResetCheckbox:true});
UpdateContext({ResetCheckbox:false})

and it worked... Thanks!

javierz
Level: Powered On

Re: Reset Checkboxes in Gallery

hi

 

thank you

 

it works

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 157 members 5,306 guests
Please welcome our newest community members: