cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Community Champion
Community Champion

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
Anonymous
Not applicable

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

11 REPLIES 11
Anonymous
Not applicable

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.

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. 

Anonymous
Not applicable

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

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

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!

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!

hi

 

thank you

 

it works

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

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

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

Helpful resources

Announcements
secondImage

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.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (19,326)