Forums

Chronoforms 6 display DIV conditionally

szabob 13 Jun, 2019
Hi everyone,

In CF5 I put the following code to the 'Start Code' of a container:
<?php if (($form->data['ordered-doc']) != 'Book') echo 'data-load-state="hidden"';?>
This made the container hidden in a form when the condition was met. I want to achieve the same in CF6. Where can I insert the code and what should it be ?

I can achieve similar effect by putting the following code in a Custom Action of the form:
 if (($this->data['ordered-doc']) != 'Book') echo '<style>.ui.adjoining3.segment{display:none}</style>';
However, this latter solution will display the code inside the page source, which I want to avoid.

Any suggestion?

Cheers

Bob
healyhatman 13 Jun, 2019
There is the conditional area if you want something to be simply not there instead of hidden otherwise have your custom code return "hidden" when you want it hidden and use {var: customcodeblockname} in the "container class" of the field
This topic is locked and no more replies can be posted.