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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,060)