How set conditional dropdown CF7

How to create a conditional dropdown in ChronoForms.

Overview

The issue is needing to show different fixed-list options in a second dropdown based on the selection in a first dropdown.
Use a PHP action to return an array of options based on the first dropdown's value, then reference that PHP action's variable in the second dropdown's dynamic options setting.

Answered
ChronoForms v7
ro roman5527 02 Nov, 2020
Hi, how i can set conditional dropdown in CF7?

my form : https://prnt.sc/vc2rh6

i want show different values in dropdown 2 based on selected value in dropdown 1.

Thanks
Max_admin Max_admin 03 Nov, 2020
Answer
Did you check the demo form available om this feature ? New form > Demo forms > Connected Dropdowns demo
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ro roman5527 03 Nov, 2020
Hi, but this demo is load valuest from database but i want my option from dropwdown.

thnaks
Max_admin Max_admin 03 Nov, 2020
So your options are a fixed list, not from a Database table ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ro roman5527 30 Nov, 2020
Hi, how set options from fixed list ? thanks
Max_admin Max_admin 01 Dec, 2020
Hi Roman,

it works like the database, but instead of using a "Read Data" action, you will need to use either 1 PHP action or multiple "Variables" actions, the PHP should check the value passed from the first dropdown and return an array of values, then use {var:php_name} as the data source of the "Dynamic options" setting in the 2nd dropdown!

here is an example return value to be used as the data source
return [
["text" => "option 1", "value" => "op1"],["text" => "option 2", "value" => "op2"]
];
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ro roman5527 01 Dec, 2020
Hi, Max.

Thnaks. But i dont know how work it. I have demo Dynamic option dropdown.

In action view i add php : https://prnt.sc/vtrqnc

but in dropdown dynamic data i dont select this php . https://prnt.sc/vtrr6k


can you help me a little more detailed

thanks
Max_admin Max_admin 08 Dec, 2020
the PHP action will not be selectable in the source list in the dropdown settings, just type it instead of selecting:
{var:php_4}
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ro roman5527 09 Dec, 2020
Many thanks its work .

I have one question how i add condition for selected value from first dropdown . thank
ro roman5527 15 Dec, 2020
hi please can you help me .

I have this php code in action : https://prnt.sc/w2zqht

i have in first dropdown 3 values. I have to create 3 times this php code or can i have it in one? How i can do it ?

And how i add condition for second dropdown . thanks.
This topic is locked and no more replies can be posted.