web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / how to limit to select...
Power Apps
Answered

how to limit to selection of check boxes max to 3?

(0) ShareShare
ReportReport
Posted on by 397

Hello Everyone,

 

Do any one know how can below scenario be achieved. 

 

I have a  screen with 19 checkboxes. Based up on the selection it will update the column in SharePoint list. This part is working as I Expected. 

But the issue is that users can select all the checkboxes and I am not able to limit it to any 3 or max 3 only. 

Any help on this one please?

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    In the OnChange event for each CheckBox add a number variable that adds 1 if the value is true, and subtracts one if its changed to false. Then set the display mode on each to Edit if the variable < 3 and disabled if not. 

     

    Edit: Just to clarify each checkbox would use the same variable. 

     

    Dustin 

  • rajkumar88 Profile Picture
    397 on at

    @Anonymous 

     

    I am sorry to asl you again. I am bit new to this and not sure where and how to add exactly. can you please elaborate steps if possible with example? Sorry to bother you. 

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    The option I was thinking of was to do the same thing for each checkbox, but then disable/enable the Submit button depending on whether the value of the resulting variable was <3.  That way they can still access the checkboxes to change their selections, but can only submit if they select 3 or less.

  • rajkumar88 Profile Picture
    397 on at

    @Pstork1 

    can we also say that please select only 3 as a small pop-up or hide.unhide text box along with submit button? 

     

    and can you please let me know where and how to add code on these checkboxes? 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    ChkBx1.pngChkBx2.png

  • rajkumar88 Profile Picture
    397 on at

    @Anonymous  thanks a lot dustin. Let me quickly test it and get abck to you. 

     

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    In the OnStart for the app use this code

    Set(checkedBoxes,0)

    For each Checkbox put the following code in the OnChecked property

    Set(checkedBoxes,checkedBoxes+1)

    And this goes in the OnUnChecked property

    Set(checkedBoxes,checkedBoxes-1)

    Then put this in the Visible property of the error label

    If(checkedBoxes > 3,true,false)

    And this in the Display Mode property for the button

    If(checkedBoxes > 3,DisplayMode.Disabled,DisplayMode.Edit)

    That should be all you need.

  • rajkumar88 Profile Picture
    397 on at

    hi @Anonymous ,

     

    you solution is disabling other checkboxes after 3 selections and there is no other way to uncheck and check other checboxes. From user prespective they will be confused why remaining are disabled and not allowing them to re-check other checboxes. Do we need to click on reset to select new 3checkboxes? 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    For DisplayMode try this: If(Or(CheckBox1.value,sCount<3),DisplayMode.Edit,Disabled)

     

    The above should allow the three that are checked to be unchecked (Edit).

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    That's why I suggested disabling the submit button instead.  That leaves the checkboxes open to be checked or unchecked, but the user can't submit until they have 3 or less checked.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard