problem with hide/show textarea when checkbox is clicked

How to show or hide a textarea when a checkbox is clicked in ChronoForms.

Overview

The issue occurs because the form elements lack proper ID attributes, preventing the JavaScript from targeting them correctly.
Ensure both the checkbox and textarea have unique IDs set in their input settings within the CF form editor.

Answered
de dekoforce 29 Jun, 2014
Hi there!

I checked this FAQ - http://www.chronoengine.com/faqs/58-cfv4/cfv4-elements-and-html/2645-how-can-i-showhide-a-textarea-when-a-checkbox-is-clicked.html

but it doesn´t work with me! It seems that my checkbox doesnt have the "click" event.
Can you please check this Form:
http://palettenkonto.net/index.php?option=com_chronoforms&tmpl=component&chronoform=Bestellung_v3

I would like to use the checkbox "checkbox_lizenz" to show the textarea "input_lizenzanschrift".

Where is the error? Any suggestions?
Gr GreyHead 29 Jun, 2014
Answer
HI dekoforce,

The textarea doesn't have an ID set - please try adding input_lizenzanschrift to the ID box on the input settings (and similarly for the checkbox and other inputs).

Bob
de dekoforce 29 Jun, 2014
THAT´S IT!!

Thank you for your quick reply! That was the solution.
I have already tried it, but if you don´t fill the id box in the settings, the div id="input_lizenzanschrift_container_div" is automatically changed to id="input_lizenzanschrift1_container_div".
So i changed also this line in your script:

div = $(textarea_id+'_container_div');
to
div = $(textarea_id+'1_container_div');

after that, i also tried to fill the id in settings, but it doesn´t work - because now the div id was id="input_lizenzanschrift_container_div" and not id="input_lizenzanschrift1_container_div" anymore.

So, just an evil twist.

Again, thanks for your solution and this chronoform is a really good stuff!!

Bye

DEKOforce
This topic is locked and no more replies can be posted.