cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerSäm
New Member

Checkboxes - activate one at a time, not both, how?

Hello together,

 

I am relatively new here... I am looking for a way to set the control boxes so that when one is activated, the other can not be activated, that is, that only "YES" or only "NO" can be checked, not both. How can this be set? (See picture)

 

image.png

 

I am grateful for any help.

 

Best regards

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Microsoft
Microsoft

Hi @PowerSäm ,

 

1\ Add a check box control 'Checkbox1' and set its Default property to:

false

 

Set 'Checkbox1' 's OnCheck property to:

Reset(Checkbox2)

 

2\ Add a check box control 'Checkbox2' and set its Default property to:

false

 

Set 'Checkbox2' 's OnCheck property to:

Reset(Checkbox1)

 

3\ The result is as follows:

AAA.gif

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

View solution in original post

2 REPLIES 2
Elias-V
Advocate I
Advocate I

Hi PowerSäm,

it depends what behaviour you want your application to have. Would you prefer if the checkbox was clickable but automatically removed the check on the other checkbox, or rather that you can't check it.

 

Either way you could put checks on the OnCheck/OnUncheck actions.

For example if you want it to be uncheckable; in both checkboxes' OnCheck:

If(otherCheckbox.Value, false, true)

 

and if you want it to take override the other checkbox I think you'll need a variable to keep track for example something like 

in the screen OnVisible you Set(varCheckboxOn1, false); Set(varCheckboxOn2, false);

checkbox1 Default: varCheckboxOn1

checkbox2 Default: varCheckboxOn2

and then on the OnCheck and OnUncheck action in both checkboxes you can adjust them however you want

 

 

Hope this helps

 

v-xiaochen-msft
Microsoft
Microsoft

Hi @PowerSäm ,

 

1\ Add a check box control 'Checkbox1' and set its Default property to:

false

 

Set 'Checkbox1' 's OnCheck property to:

Reset(Checkbox2)

 

2\ Add a check box control 'Checkbox2' and set its Default property to:

false

 

Set 'Checkbox2' 's OnCheck property to:

Reset(Checkbox1)

 

3\ The result is as follows:

AAA.gif

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

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

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (47,456)