Buy Now
Sign in

CC6 Dynamic Dropdown for filtering table

webbusteruk , December 07 at 03:45
Answered
W
webbusteruk
Wonder if anyone could help.
We are using CC6 to display a table, along with 2 dropdown filters. The options within the 2nd dropdown filter depends on what is chosen for the 1st dropdown filter. In Chronoforms6, this is achieved by using {var:somephpcode} under the 2nd dropdown's options. However, doing the same in CC6 seems to be much more difficult.
Tried using the exact same {var:somephpcode} under dropdown's options in CC6 doesn't seem to work. Is there any way to achieve this?
$options = [];​
​switch($this->data('course')){​
​ case '1':​
​ $options = ['A' => 'A'];​
​ break;​
​ case '2':​
​ $options = ['B' => 'B' , 'C' => 'C']​
​ break;​
​ case '3':​
​ $options = ['D' => 'D'];​
​ break;​
​ default:​
​ $options = ['N/A' => 'Please select one'];​
​}​
​return $options;
The above works when put into a <php> in CF. When put into CCv6, it does not output anything.
$options = '';​
​switch($this->data('course')){​
​ case '1':​
​ $options = 'A';​
​ break;​
​ case '2':​
​ $options = 'B , C';​
​ break;​
​ case '3':​
​ $options = 'D';​
​ break;​
​ default:​
​ $options = 'Please select one';​
​}​
​echo $options;
When output as an echo, it correctly shows up within the dropdown's options. However, we can't make display multiple options. What format does the {var:} has to output into the dropdown's options? Array doesn't work.
healyhatman
So you need to create an event (have you done this?) and in this event you should have something along the lines of
{fn:somephpcode}​
​{view:second_dropdown}
The event name is what should go in the "Reload Event" box of the second dropdown.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman