Using the code explained in this FAQ http://www.chronoengine.com/faqs/2645-how-can-i-showhide-a-textarea-when-a-checkbox-is-clicked.html I got the following error in JS console:
Uncaught TypeError: Object #<HTMLDivElement> has no method 'dissolve'.
I'm using Joomla 1.5.17 and Chronoforms v.4.
Hope you can help me🙂
Uncaught TypeError: Object #<HTMLDivElement> has no method 'dissolve'.
I'm using Joomla 1.5.17 and Chronoforms v.4.
Hope you can help me🙂
Hi capitanluc,
Probably this doesn't exist in the MooTools version you are using (Joomla 1.5 uses MooTools 1.2 and current versions use MooTools 1.4). You can probably edit the code to use .setStyle('display', 'block') and .setStyle('display', 'none') to show and hide the elements.
Bob
Probably this doesn't exist in the MooTools version you are using (Joomla 1.5 uses MooTools 1.2 and current versions use MooTools 1.4). You can probably edit the code to use .setStyle('display', 'block') and .setStyle('display', 'none') to show and hide the elements.
Bob
Thanks a lot. What I did before to read your kind answer was to modify the script as follows:
It was just a small and dirty workaround but the results is exactly what I really wanted. In fact the textarea does not disappear but is disabled or enabled according to the checkbox status. At the same time the script modifies the required attribute.
Thanks again.
Luciano
var checkbox_id, textarea_id, checkbox, textarea, div;
/* edit the next two lines to match the ids of the elements in your form */
checkbox_id = "k2013paymentmethod";
textarea_id = "k2013mtcn";
window.addEvent('domready', function() {
checkbox = $(checkbox_id);
textarea = $(textarea_id);
div = $(textarea_id+"_container_div");
// div.dissolve();
showHide();
checkbox.addEvent('click', showHide);
});
function showHide() {
if ( checkbox.checked ) {
// div.reveal();
textarea.disabled = false;
textarea.required= true;
} else {
// div.dissolve();
textarea.value = '';
textarea.disabled = true;
textarea.required= false;
}
}
It was just a small and dirty workaround but the results is exactly what I really wanted. In fact the textarea does not disappear but is disabled or enabled according to the checkbox status. At the same time the script modifies the required attribute.
Thanks again.
Luciano
This topic is locked and no more replies can be posted.