Checkboxes Element - Maximum...

User 2852450 Photo


Registered User
2 posts

Hi,
I have a list of 4 checkboxes and a minimum of 1 check but maximum selection 2. I have already configured the "Require option to be checked to 2" but it allows me to choose till 4 seleciton. Is there a way to put a maximum amount of selections??

Best Regards
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

Paste this to a HTML element in your form builder.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script>var jQ = $.noConflict(true);
jQ(document).ready(function(){
var limit = 3;
jQ("input[name^='checkbox1']").on('change', function(evt) {
if (jQ("input[name^='checkbox1']:checked").length == limit) {
this.checked = false;
}
});
});</script>

You can see it working here.
http://progrower.coffeecup.com/forms/re … selection/
If you want it to work on several checkbox groups remove the number from the end of the name reference in the script and it will only allow 2 across both groups instead of just checkbox1 as in my example. My example assumes an input with a name of checkbox1
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2852450 Photo


Registered User
2 posts

Thanks a lot ...it works perfect.!! :-)

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.