Hi;
I have a multipageform. I am trying to show/hide a text field which is in 2nd page according to 1st page radiogroup. I read https://www.chronoengine.com/faqs/2645-how-can-i-showhide-a-textarea-when-a-checkbox-is-clicked and I preapeared a custom code event on load event (first event) after display_section1 event. My custom code event is like this:
<script type="text/javascript">
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 = 'tur[0]';
textarea_id = 'myname';
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;
} else {
div.dissolve();
textarea.value = '';
textarea.disabled = true;
}
}
</script>
But this is not work.
Thanks for your help.
I have a multipageform. I am trying to show/hide a text field which is in 2nd page according to 1st page radiogroup. I read https://www.chronoengine.com/faqs/2645-how-can-i-showhide-a-textarea-when-a-checkbox-is-clicked and I preapeared a custom code event on load event (first event) after display_section1 event. My custom code event is like this:
<script type="text/javascript">
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 = 'tur[0]';
textarea_id = 'myname';
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;
} else {
div.dissolve();
textarea.value = '';
textarea.disabled = true;
}
}
</script>
But this is not work.
Thanks for your help.