cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How do I OnCheck, UnCheck another checkbox?

Just started and have a form to make with a lot of questions that contain 3 checkboxes each.

 

As the user can only select one of the boxes for each question and the forms text generated is decided by which boxes they ticked, how can I make it so the ticking of one box immediately unticks the other 2 in that question sector so the user doesn't have to tick and then untick it to tick another or forgets to which messes up the form?

 

I tried editting the OnCheck part of "checkbox a" to say "checkbox b".Value = false but that didn't work. I also tried editing the reset part to be if("checkbox x".Value = true, true) so that it reset if another was ticked, which worked until I did it for all 3 of them and I got an error saying you can't refer to a value dependant on your value. 

 

Anyone know how I could achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: How do I OnCheck, UnCheck another checkbox?

Hi

 

I hope I understand what you want:

 

Create 3 CheckBox, with Survey Questions. set:

- each CheckBox.Default with a context variable

- each CheckBox.OnCheck = UpdateContext({....}); UpdateContext({...}) in PAIR (it is a must).

 

Look at my example as attached (screenshot), and it will definitely work.

 

Screenshot (498).png

 

 

 

In fact, if you are OK, why not use ListBox which allow SelectMultiple = False and you can get it done more easily.

 

Hope this helps.

 

Have a nice day.

hpkeong
4 REPLIES 4
Super User
Super User

Re: How do I OnCheck, UnCheck another checkbox?

Hi

 

I hope I understand what you want:

 

Create 3 CheckBox, with Survey Questions. set:

- each CheckBox.Default with a context variable

- each CheckBox.OnCheck = UpdateContext({....}); UpdateContext({...}) in PAIR (it is a must).

 

Look at my example as attached (screenshot), and it will definitely work.

 

Screenshot (498).png

 

 

 

In fact, if you are OK, why not use ListBox which allow SelectMultiple = False and you can get it done more easily.

 

Hope this helps.

 

Have a nice day.

hpkeong
jhuynh
Level: Powered On

Re: How do I OnCheck, UnCheck another checkbox?

How would I do this if all checkboxes were in  a gallery? How would I reference another checkbox in a gallery?

Super User
Super User

Re: How do I OnCheck, UnCheck another checkbox?

Did you figure out the Gallery piece? I'm having a similar issue: 

 

Scenario: 

  • "SelectAll" Checkbox outside Gallery
  • Checkbox1 placed in Gallery
  • Checkbox1 OnCheck property set to ClearCollect(selectedItems, ThisItem)
  • Checkbox1 Default property set to selectAll_Checkbox.Value
  • Checking Checkbox1 adds it to the selectedItems Gallery, no problem.
  • Checking selectAll_Checkbox puts a check in all the Checkboxes in the Gallery, but they are not added to the selectedItems Gallery. 

Thoughts on this one?

Phillip-JCI
Level: Powered On

Re: How do I OnCheck, UnCheck another checkbox?

Checkbox 1 is xval1, checkbox 2 xval2, checkbox 3 xval3. The picture shows all as xval1. Everything else is correct, thank you for your example.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 45 members 4,302 guests
Please welcome our newest community members: