# Limiting checkbox selections

**URL:** <https://forum.kirupa.com/t/limiting-checkbox-selections/183439>\
**Category:** Uncategorized\
**Created:** [March 27, 2006, 3:18am UTC](https://forum.kirupa.com/t/limiting-checkbox-selections/183439 "2006-03-27T03:18:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmreyes](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jmreyes](https://forum.kirupa.com/u/jmreyes)\
**Post date:** [March 27, 2006, 3:18am UTC](https://forum.kirupa.com/t/limiting-checkbox-selections/183439/1 "2006-03-27T03:18:04Z")

</div>

Hi guys,

Ive been stuck with this problem for some time.  
Hope you guys can help me out.

I have 45 check boxes. I figured out how to get the info on what items the user has selected using arrays.

Heres my problem:

On click of the submit button, how can i trap and inform the user that he can only check exactly 4 boxes. no more no less.

Sounds simple but i cant figure it out.  
Anybody?

---

<div class="post-metadata">

**Author:** ![jmreyes](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jmreyes](https://forum.kirupa.com/u/jmreyes)\
**Post date:** [March 28, 2006, 6:44am UTC](https://forum.kirupa.com/t/limiting-checkbox-selections/183439/2 "2006-03-28T06:44:12Z")

</div>

Anybody guys?

Ok let me rephrase, probably easier…

Is there a way to count how many of the 45 checkboxes have a check mark (selected) on them?
