show/hide textfield in multipageform

emrahsevgi 23 Dec, 2018
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 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');
checkbox.addEvent('click', showHide);

function showHide() {
if ( checkbox.checked ) {
textarea.disabled = false;
} else {
textarea.value = '';
textarea.disabled = true;

But this is not work.

Thanks for your help.
GreyHead 24 Dec, 2018
Hi emrahsevgi ,

Which version of ChronoForms re you using?

A multi-page form is normally submitted to the server between pages so your JavaScript will not work, you need to show/hide the text field in the Load event for the second page.

emrahsevgi 24 Dec, 2018

Thanks for your reply. I am using v6. I understood that I will use javascript on second page. I used javascript on second page after event loader. I used my custom code' s (Javascript code) name instead of event name. But it does not work. I am newbie on chronoform. I can not learn setup sections events at the moment. Does my javascript code work with radiogroup and does my code wrong?

healyhatman 24 Dec, 2018
If you really really want to use javascript to do what you're trying to do, you need to read up on Semantic-UI, the framework CF uses.

OR you could just use the field Events built in to Chronoforms, which would be much easier. Read the manual, and look at the demo forms.
This topic is locked and no more replies can be posted.