cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PivotMananger
Helper I
Helper I

disable multiple check on checkboxes with three results

Im using my Checkboxes  to validate data to my CDS. 

This already works like a charm but unfortunately you can click both boxes.

But there should be only three options:

 

* Left box is checked (1:0)

* Right box is checked  (0:1)

* Both boxes are unchecked (0:0)

 

 

 

        KlappenFunktion: If(
            KlappenFunktionIO.Value = true;
            KlappenEingestelltIO.Value;
            If(
                KlappenFunktionNIO.Value = true;
                KlappenFunktionNIO.Value;
                ""
            )
        );

 

 

This is how im Saving my Value.

So there is always a priority: LeftBox > RightBox > Unchecked

 

My goal is to disable the possibility to check both boxes at the same time.

I only want to use checkbox elements.

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Super User
Super User

Hi, 

 

You need to control the DisplayMode of each Checkbox based on the other's value. For example, I have two checkboxes Checkbox1 and Checkbox2. 

 

DisplayMode of Checkbox1 = If(Checkbox2.Value, DisplayMode.Disabled, DisplayMode.Edit)

 

DisplayMode of Checkbox2 = If(Checkbox1.Value, DisplayMode.Disabled, DisplayMode.Edit)

 

It basically checks if the value of the other checkbox is true, if it is, then it disables the checkbox. Please let me know if this works for you. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

View solution in original post

8 REPLIES 8
PowerAddict
Super User
Super User

Hi, 

 

You need to control the DisplayMode of each Checkbox based on the other's value. For example, I have two checkboxes Checkbox1 and Checkbox2. 

 

DisplayMode of Checkbox1 = If(Checkbox2.Value, DisplayMode.Disabled, DisplayMode.Edit)

 

DisplayMode of Checkbox2 = If(Checkbox1.Value, DisplayMode.Disabled, DisplayMode.Edit)

 

It basically checks if the value of the other checkbox is true, if it is, then it disables the checkbox. Please let me know if this works for you. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

@PowerAddictWhat if you have 10 checkboxes? I tried using your formula

DisplayMode of Checkbox1 = If(Checkbox2.Value, DisplayMode.Disabled, DisplayMode.Edit) & If(Checkbox3.Value, DisplayMode.Disabled, DisplayMode.Edit)

DisplayMode of Checkbox2 = If(Checkbox1.Value, DisplayMode.Disabled, DisplayMode.Edit) & If(Checkbox3.Value, DisplayMode.Disabled, DisplayMode.Edit)

DisplayMode of Checkbox3 = If(Checkbox2.Value, DisplayMode.Disabled, DisplayMode.Edit) & If(Checkbox1.Value, DisplayMode.Disabled, DisplayMode.Edit)

 

But it doesnt work for me 😞

Actually I just simplified the process..

 

On the oncheck property of the checkbox I reset the other checkboxes.. like this:

 

Reset(WirelessOutageCheckbox);Reset(WirelessCheckbox);Reset(ServerMaintCheckbox);Reset(PowerOutageCheckbox);Reset(PowerMaintCheckbox);Reset(NetworkMaintCheckbox);Reset(InternetMaintCheckbox);Reset(InternetOutageCheckbox); Reset(NetworkDeviceOutageCheckbox)

Traconis
Frequent Visitor

But what to do if I got only one checkbox? The data is taken from the SharePoint list so there is only one checkbox control in the UI. That mean I can't validate its contents based on the other checkboxes. 

Can you provide an example?You should still be able to validate based on the checkboxes even if only 1 has data taken from SP list.

Traconis
Frequent Visitor

Hi Leslie,

 

as you can see on the UI below each entry is the item taken from the SharePoint list using filtering:

Traconis_0-1638374881266.png

But in  the App builder this is a single set of controls i.e. label for the bold code on the left (i.e. 3b2, some other text and the checkbox).

 

The problem is when app filters lists items it may find more than one (in fact it should because it filtering out all available workstations) however in the app builder I can only edit a single checkbox control so trying to figure out a function for onCheck and onUncheck as well as OnSelect to somehow disable checking more than one box at the same time.

 



leslie_rivera
Helper V
Helper V

@Traconis 
What worked for me was to reset the other checkboxes in the oncheck function. See below example:

leslie_rivera_0-1638823684460.png

I have it so a person can only select 1 check box. By selecting that checkbox it resets all the other checkboxes.

 

 

AlloftheAbove

AllCheckbox

OnCheck: Reset(WirelessSysCheckbox);Reset(FileAccessCheckbox);Reset(PhonesCheckbox);Reset(InternetAccessCheckbox);Reset(JDECheckbox)

 

WirelessSys

WirelessSysCheckbox

OnCheck: Reset(JDECheckbox);Reset(AllCheckbox);Reset(PhonesCheckbox);Reset(InternetAccessCheckbox);Reset(FileAccessCheckbox)

 

Phones

PhonesCheckbox

OnCheck: Reset(WirelessSysCheckbox);Reset(AllCheckbox);Reset(JDECheckbox);Reset(InternetAccessCheckbox);Reset(FileAccessCheckbox)

 

JDEAccess

JDECheckbox

OnCheck: Reset(WirelessSysCheckbox);Reset(AllCheckbox);Reset(PhonesCheckbox);Reset(InternetAccessCheckbox);Reset(FileAccessCheckbox)

 

InternetAccess

InternetAccessCheckbox

OnCheck: Reset(WirelessSysCheckbox);Reset(AllCheckbox);Reset(PhonesCheckbox);Reset(JDECheckbox);Reset(FileAccessCheckbox)

 

FileAccess

FileAccessCheckbox

OnCheck: Reset(WirelessSysCheckbox);Reset(AllCheckbox);Reset(PhonesCheckbox);Reset(JDECheckbox);Reset(InternetAccessCheckbox)

 

Traconis
Frequent Visitor

Thanks! This worked for me as well 🙂

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (4,194)