Hello,
I am trying to setup an Chronoform that displays a single dropdown menu to select a single value (in this case, the name of a shop) from a list. I would like to use the Chosen or Select2 jQuery plugin to change the way the pulldown works. I tried Chosen first as that should be included in Joomla! 3.3 and tried Select2 later as well (For those not familiar with Chosen and Select2, here are 2 links with demo's: http://harvesthq.github.io/chosen/ and http://ivaynberg.github.io/select2/ ).
In my Chronoform, I have first included a Custom Code that runs the following code:
Then, I include a Load Javascript action before the HTML (Render Form) action:
I double checked that #pulldown-winkels is the corect id of the select I am trying to change.
When I then preview or run the form, the javascript console in my browser reports the following:
and the pulldown is shown as a normal pulldown, no Chosen formatting and/or behavior.
I tried the same with Select2 but I get the same error message. i coudble checked that both the .js and .css files are called correctly in the preceeding code and that these fields exist as well.
Can somebody understand why this error appear and explain to me how to solve it ?
Many thanks in advance,
Erik
I am trying to setup an Chronoform that displays a single dropdown menu to select a single value (in this case, the name of a shop) from a list. I would like to use the Chosen or Select2 jQuery plugin to change the way the pulldown works. I tried Chosen first as that should be included in Joomla! 3.3 and tried Select2 later as well (For those not familiar with Chosen and Select2, here are 2 links with demo's: http://harvesthq.github.io/chosen/ and http://ivaynberg.github.io/select2/ ).
In my Chronoform, I have first included a Custom Code that runs the following code:
<?php
$document = JFactory::getDocument();
$document->addScript('/media/jui/js/chosen.jquery.js');
$document->addStyleSheet('/media/jui/css/chosen.css');
?>
Then, I include a Load Javascript action before the HTML (Render Form) action:
jQuery(document).ready(function(){
jQuery("#pulldown-winkels").chosen();
});
I double checked that #pulldown-winkels is the corect id of the select I am trying to change.
When I then preview or run the form, the javascript console in my browser reports the following:
TypeError: jQuery(...).chosen is not a function
and the pulldown is shown as a normal pulldown, no Chosen formatting and/or behavior.
I tried the same with Select2 but I get the same error message. i coudble checked that both the .js and .css files are called correctly in the preceeding code and that these fields exist as well.
Can somebody understand why this error appear and explain to me how to solve it ?
Many thanks in advance,
Erik