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

10 REPLIES 10
Highlighted
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.

Highlighted
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

Highlighted
Super User
Super User

Re: Reset Checkboxes in Gallery

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

Highlighted
Advocate I
Advocate I

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!

Highlighted
Advocate I
Advocate I

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!

Highlighted
Advocate II
Advocate II

Re: Reset Checkboxes in Gallery

hi

 

thank you

 

it works

Highlighted
Frequent Visitor

Re: Reset Checkboxes in Gallery

Thank-YOU! I searched for 4 hours looking for this. 

Highlighted
Regular Visitor

Re: Reset Checkboxes in Gallery

Thanks it worked but why two times we've update the context?

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

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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