I would like to know if you can restrict a users using checkbox group. I have 25 product that they can choose form but they can only select 21. Is this possible with chronoforms?
Hello janman,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I have a 'select all' option in a checkbox group?
How do I build a select drop-down, radio button or checkbox group?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I have a 'select all' option in a checkbox group?
How do I build a select drop-down, radio button or checkbox group?
P.S: I'm just an automated service😉
Hi Janman,
Yes it is possible - but needs some custom JavaScript to do it.Here's the code from a similar project limiting the number of 'files' that can be selected with checkboxes
Bob
Yes it is possible - but needs some custom JavaScript to do it.Here's the code from a similar project limiting the number of 'files' that can be selected with checkboxes
jQuery(document).ready(function (jQ) {
var files;
files = jQ('input[name="file_select[]"]');
files.on('click', checkCount);
function checkCount() {
var files_checked;
files_checked = jQ('input:checkbox[name="file_select[]"]:checked');
if ( files_checked.length >= 5 ) {
jQ('#complete').css('visibility', 'visible');
files.each(function (){
if ( !jQ(this).prop('checked') ) {
jQ(this).prop('disabled', true);
}
});
} else {
jQ('#complete').css('visibility', 'hidden');
files.each(function () {
jQ(this).prop('disabled', false);
});
}
}
});
What this does is to disable all the un-checked boxes once five have been checked, if one of those is un-checked then they are all re-enabled.
Bob
Thanks bob for the quick response. i am looking to do the following
http://www.plus2net.com/javascript_tutorial/checkbox-limit.php
http://www.plus2net.com/javascript_tutorial/checkbox-limit-demo.php
Thanks.
Jan
http://www.plus2net.com/javascript_tutorial/checkbox-limit.php
http://www.plus2net.com/javascript_tutorial/checkbox-limit-demo.php
Thanks.
Jan
Hi Bob
i Found this
http://www.chronoengine.com/forums/posts/f5/t17581.html
will it work with V5?
i Found this
http://www.chronoengine.com/forums/posts/f5/t17581.html
will it work with V5?
Hi janman,
What do those examples do that is different from the code I have already posted?
Bob
What do those examples do that is different from the code I have already posted?
Bob
Hi Bob
Please check i have added the JavaScript code with no luck
http://1021dev.co.za/ladybug/index.php?option=com_chronoforms5&chronoform=Products
Thanks
Jan
Please check i have added the JavaScript code with no luck
http://1021dev.co.za/ladybug/index.php?option=com_chronoforms5&chronoform=Products
Thanks
Jan
Hi Jan,
It looks as if you haven't edited to code to match the name of the Checkbox group in your form.
Bob
It looks as if you haven't edited to code to match the name of the Checkbox group in your form.
Bob
Hi Bob
check box group name is "checkbox_group1"
Am i missing something else?
check box group name is "checkbox_group1"
Am i missing something else?
jQuery(document).ready(function (jQ) {
var files;
files = jQ('input[name="checkbox_group1[]"]');
files.on('click', checkCount);
function checkCount() {
var files_checked;
files_checked = jQ('input:checkbox[name="checkbox_group1[]"]:checked');
if ( files_checked.length >= 5 ) {
jQ('#complete').css('visibility', 'visible');
files.each(function (){
if ( !jQ(this).prop('checked') ) {
jQ(this).prop('disabled', true);
}
});
} else {
jQ('#complete').css('visibility', 'hidden');
files.each(function () {
jQ(this).prop('disabled', false);
});
}
}
});
This topic is locked and no more replies can be posted.