Dear Chronoengine
I am trying to limit the amount of checkboxes that can be selected (exactly14 out of 20 boxes) and followed all the steps in this topic:
https://www.chronoengine.com/forums/posts/f26/t90709.html?page=2
I'm using:
Joomla Beez template
Chronoforms 4.05
Joomla 3.23
I used the code in the topic and made the following changes as per the topic:
Changed the first checkbox id to: input_checkbox_group_7_0
Changed the form name in the 3 lines to: nomin2
Used both:
var group = el.getSiblings(['input']);
and without the square brackets,
var group = el.getSiblings('input');
Also saved the form type as Custom and removed checkbox divs (when doing the form in Wizard it seems to add divs to all the checkboxes in the group)
Then added the JS code first before Show html, into Events, On Load, Load JS
Dynamic file settings: I tried Yes and No
I tried everything I could, but nothing seem to have any effect on limiting the checkbox selections.
Here is my latest attempt at the JS code:
http://www.fineartist.co.za/solar/index.php?option=com_chronoforms&chronoform=nomin2
Dearly hope you can point me in the right direction. I am not a coder and am probably overlooking something totally silly.
Francois
Herewith the JS code I used:
I am trying to limit the amount of checkboxes that can be selected (exactly14 out of 20 boxes) and followed all the steps in this topic:
https://www.chronoengine.com/forums/posts/f26/t90709.html?page=2
I'm using:
Joomla Beez template
Chronoforms 4.05
Joomla 3.23
I used the code in the topic and made the following changes as per the topic:
Changed the first checkbox id to: input_checkbox_group_7_0
Changed the form name in the 3 lines to: nomin2
Used both:
var group = el.getSiblings(['input']);
and without the square brackets,
var group = el.getSiblings('input');
Also saved the form type as Custom and removed checkbox divs (when doing the form in Wizard it seems to add divs to all the checkboxes in the group)
Then added the JS code first before Show html, into Events, On Load, Load JS
Dynamic file settings: I tried Yes and No
I tried everything I could, but nothing seem to have any effect on limiting the checkbox selections.
Here is my latest attempt at the JS code:
http://www.fineartist.co.za/solar/index.php?option=com_chronoforms&chronoform=nomin2
Dearly hope you can point me in the right direction. I am not a coder and am probably overlooking something totally silly.
Francois
Herewith the JS code I used:
window.addEvent('domready', function() {
var checkbox;
checkbox = $('input_checkbox_group_7_0');
checkbox.addClass("validate['%countCheck']");
if ( typeof formCheck_nomin2 !== 'undefined' ) {
formCheck_nomin2.dispose(checkbox);
formCheck_nomin2.register(checkbox);
}
});
var countCheckMax = 3;
var countCheckMin = 1;
function countCheck(el) {
var group = el.getSiblings(['input']);
group.include(el);
var count = 0;
group.each(function(item) {
if ( item.checked ) {
count++;
}
});
if ( count > countCheckMax ) {
el.errors.push("You can only check "+countCheckMax+" items");
return false;
} else if ( count < countCheckMin ) {
el.errors.push("Please check at least "+countCheckMin+" items");
return false;
} else {
return true;
}
}
Hi Francois
I just clicked on the link and opened Firebug...
In the console I get an error:
your JS is not be executed...
I just clicked on the link and opened Firebug...
In the console I get an error:
TypeError: window.addEvent is not a function
window.addEvent('domready', function() {
your JS is not be executed...
Thanks very much Ie5
I copied the original code from the V4 forum post and don't understand why it is not being executed. Is there anything I am doing wrong in Chronoforms - what should I do to get it executed?
Any advice/help appreciated. I've been trying for a few days to put a limit on Chronoform checkbox selections, but nothing seems to work.
Francois
I copied the original code from the V4 forum post and don't understand why it is not being executed. Is there anything I am doing wrong in Chronoforms - what should I do to get it executed?
Any advice/help appreciated. I've been trying for a few days to put a limit on Chronoform checkbox selections, but nothing seems to work.
Francois
Hi artery,
In Joomla! 3 the MooTools is not loaded by default in Joomla! (they've gone over to JQuery as the main library). ChronoForms will load it but sometimes the load sequence is wrong so when your custom script tries to run MooTools isn't available. Please see this FAQ for some solutions.
Bob
In Joomla! 3 the MooTools is not loaded by default in Joomla! (they've gone over to JQuery as the main library). ChronoForms will load it but sometimes the load sequence is wrong so when your custom script tries to run MooTools isn't available. Please see this FAQ for some solutions.
Bob
Thanks very much Greyhead
The coding/Mootools/JQuery part is way over my head. If this implies that none of the examples provided in the forum for limiting checkbox selection will work any more after Joomla 3, is there any other easier/non-coding way to put a limit on the Chronoforms checkbox selections? If there is, please point me in the right direction. If not, I can try a Joomla 2.5 installation.
The coding/Mootools/JQuery part is way over my head. If this implies that none of the examples provided in the forum for limiting checkbox selection will work any more after Joomla 3, is there any other easier/non-coding way to put a limit on the Chronoforms checkbox selections? If there is, please point me in the right direction. If not, I can try a Joomla 2.5 installation.
Just some feedback - I downloaded the Mootools Enabler/Disabler plug-in, enabled it for com_chronoforms, but am still getting the same error:
This is on Joomla 3,
window.addEvent is not a function
This is on Joomla 3,
This topic is locked and no more replies can be posted.