cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Toggle checkboxes (2 sets)

Hi guys, I have two checkbox in 2 columns that will act like a radio button

 

Example:

column 1        column 2

 

CboxOne         CboxTwo

 

So, if CboxOne is tick or check. CboxTwo will be unchecked.

Likewise, if CboxTwo is check, Cboxone will be unchecked.

 

Basically, each checkbox has a group of checkboxes that will appear only if either CboxOne or CboxTwo is ticked.

 

Any ideas on how to do this? Thank you. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @sirch2020 ,

Put this on both the OnCheck and OnUncheck of both checkboxes

UpdateContext({vCheck:!vCheck})

On the Default of one box put

vCheck

and on the other 

!vCheck

You will find that they will "toggle" on and off if you change either.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

7 REPLIES 7
Super User III
Super User III

Hi @sirch2020 ,

Put this on both the OnCheck and OnUncheck of both checkboxes

UpdateContext({vCheck:!vCheck})

On the Default of one box put

vCheck

and on the other 

!vCheck

You will find that they will "toggle" on and off if you change either.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

Resolver I
Resolver I

Hey @sirch2020 ,

 

Lets say you have 4 checkbox One, two, three & four.

 

I would recommend you to take two global variables varCheckBoxThree & varCheckBoxFour.

 

(These are two different checkboxes that will become visible & invisible based upon CheckboxOne & CheckboxTwo input respectively. If checboxOne is checked CheckboxThree will be visible & if unchecked CheckboxThree will be unvisible. Similarly, If checboxTwo is checked CheckboxFour will be visible & if unchecked CheckboxFour will be unvisible).

 

Step - 1: Set them both 'false' OnApp Start functionality.

Syntax: Set(varCheckBoxThreeVisibility, false) Set(varCheckBoxFourVisibility, false)

 

Step - 2: Set the visible property of CheckboxThree and CheckboxFour.

Syntax:

For CheckBoxThree use varCheckBoxThreeVisibility

For CheckBoxFour use varCheckBoxFourVisibility

 

Step - 3: Set the Oncheck & OnUncheck property for CheckBoxOne

Syntax:

For OnCheck use: Set(varCheckBoxThreeVisibility, True); Set(varCheckBoxFourVisibility, false); Reset(CheckBoxTwo)

For OnUnCheck use: Set(varCheckBoxThreeVisibility, false);

 

Step - 4: Set the Oncheck & OnUncheck property for CheckBoxTwo

Syntax:

For OnCheck use: Set(varCheckBoxThreeVisibility, false); Set(varCheckBoxFourVisibility, True); Reset(CheckBoxOne)

For OnUnCheck use: Set(varCheckBoxFourVisibility, False);

 

Now, test your case.

 

I hope this simplifies your query if any more question let me know.

 

Warmly

----------------------------------------------------------------------------------------------------------------

Thanks for taking my inputs. If you're digging into it, a Thumbs up is appreciated! Or if my suggestion solved your issue, please Accept it as a solution. This way everyone would be able to get the solution if they face a similar problem

 

@WarrenBelz sorry for being a noob on this, the default that you mentioned is it on the "advance" tab with the word 'default'? How do I set the default? Thank you.

@sirch2020 ,

Select the Item and then Default for the drop-down at top left., then type in the value in the box just to the right of this.

You can also set the OnCheck and OnUncheck here.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

I actually did change  the default with the method you provided, but I got an error.

Error is: Name isn't valid. This identifier isn't recognized.

 

What I did is I change the name of the Checkbox to vCheck and the other to !vCheck and it works fine.

 

I am just using a Checkbox on a screen display no Gallery, no form or whatsoever, but anyway it works with what @WarrenBelz  provided as a solution.

 

I am still unclear why changing the defaults will result to an error, any ideas guys?  Thanks.

 

@sirch2020 ,

You may have done it the other way around and referred to the Variable before you put any code in to set it.

Anyway, glad it now works for you.

@WarrenBelz , Thanks you could be right, because if we put the variable without any reference then yes there will be an error. Ok got it now, Cheers!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,051)