Buy Now
Sign in

2 dynamic dropdonw based on DB table

giacall , May 16 2017
Answered
G
giacall
Well.. i'm little bit confused..

I've a simple table with ID, CONTINENT, COUNTRY.
In the first dropdown i can load continent's list with a READ_DATA action in LOAD EVENT before DISPLAY SECTION action..
In the dropdown's options field -> {var:read_data}

And this work

Now i need to populate the second dropdown with only country depending the continent selected in the first dropdown.
Well.. In CF5 (if my memory is still good...) i need to create an EVENT whit another read data filtered with the value of the first dropdown...

And in the designer, link this event in the dropdown action change..

But in CF6? Wich is the best way to have 2 dynamic dropdown menu ?

Thank's

LUCA
admin
Hi Luca,

The next release has this feature, so you can wait for the next full official update or if you are in a hurry then you can send me a message using the "contact us" page and I can send you an installer.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
G
giacall
Hi Max.
Thank for feedback.

Ok i'm not in hurry. So i can wait..
I just update to 6.0.5..
Is thi s the release with the fix? Or i have to wait the next?
Thank you

LUCA
admin
Hi Luca,

Its available in the latest update, you need to set the event of the first dropdown to "reload", then set the "reload" event of the 2nd dropdown to a new form event, say "country", now in the "country" event you need to return a new "dropdown" element with the new countries list, here is how to do that:

You can use a "Custom code" action, and inside this action add this tag: {view:dropdown_name}, the dropdown_name is the view name of the dropdown which is inside a black label.

you then need to change the dropdown options list, you can do this using "data read" call before the "Custom code" action and set the dropdown options to {var:read_data_name}

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
G
giacall
Hi Max.
Sorry for the delay on reply.

Now the form work fine...
Thank's

LUCA
E
erikjo
Hi Luca and Max,

thanks a lot for solving the same issue I face at the moment.
Unfortunately I don't get Max's instruction not 100% to replicate the config in my form.

Can someone of you may be backup one form, where the two dropdowns are working and attach it here as a sample, probably easier and quicker than explaining me how to fix my form config.

I guess I did the wrong thing at that point: "then set the "reload" event of the 2nd dropdown to a new form event, say "country", now in the "country" event you need to return a new "dropdown" element with the new countries list, here is how to do that:" - what means Country event there?

If not, here is in screenshots where I am at the moment with my form, where the 2nd dropdown is not working yet.

Any help would be much appreciated.

Regards,
Erik
Attachments
1.jpg
1.jpg
(8.62 KiB)
337 Downloads/Views
2.jpg
2.jpg
(30.01 KiB)
339 Downloads/Views
3.jpg
3.jpg
(12.23 KiB)
343 Downloads/Views
4.jpg
4.jpg
(11.6 KiB)
333 Downloads/Views
5.jpg
5.jpg
(19.68 KiB)
323 Downloads/Views
G
giacall
Hi erikjo .
Attached you can find the screenshot of the configuration for the reload event based on 2 dropdown.
The first load the continent list.
The second load the list of the country for the continent selected in the first dropdown.
You need 2 dropdown element in the designer section and a load_country (or other name) in the setup with a datareader inside.

Take a look

Have a nice day

LUCA
Attachments
load-event-1.png
load-event-1.png
(30.24 KiB)
344 Downloads/Views
load-event-2.png
load-event-2.png
(24.03 KiB)
332 Downloads/Views
load-event-3.png
load-event-3.png
(20.37 KiB)
333 Downloads/Views
load-event-4.png
load-event-4.png
(27.72 KiB)
321 Downloads/Views
R
rafaelscouto
Good evening,

I need your help

I could not follow these steps above

I have two tables in the database:

iskmu_states with the columns: id, uf and name, and iskmu_cities with the columns: id, id_state and name.

I can list the states correctly, but I do not know how to link the cities to it

Now i need to populate the second dropdown with only city depending the state selected in the first dropdown.

I'm using version 6
E
erikjo
Hi Luca,

thanks a lot, I am bit further, but it still does not work.

Probably the reason, why it does not work for me is screenshot load-event3.png.

Could you please explain me the different variables in the WHERE condition?
continent:{data:continente} ?

continente comes from the name of the first dropdown - right? data? continent is the name of the data base table field from the table, which populates the 2nd dropdown table?

I attached my current form config, which is not working yet.
I also attached a screen from my 2nd table (2nd dropdown), which should populate the competitions based on the country selected in dropdown 1.

Thanks
Attachments
add_a_ground_02_Aug_2017_20_17_10.cf6bak.zip
(2.22 KiB)
42 Downloads/Views
data-model-mt_competition-2nddropdowntable.png
data-model-mt_competition-2nddropdowntable.png
(168.53 KiB)
289 Downloads/Views
G
giacall
Ok guys.. Maybe i make some mistake in my last post...
I try to better explain the flow to have 2 dynamic dropbox based on a db table.

- The first dropbox (called continent) read the continent list from database (see LOAD_CONTINENT_GENERAL)
- The first dropbox (called continent) have an events action to reload the second dropbox called country (see LOAD_CONTINENT_EVENTS)
- In setup section, you need to create a new event (for me load_country ... see LOAD_COUNTRY_EVENT_1). In this event you need to place a
---> DB_READER ACTION with WHERE box containing continent:{data:continent} (see READ_COUNTRY)
---> a custom code to reload the dropbox field with coutry depending on the continent selected in the firs dropbox (see LOAD_COUNTRY_EVENT_")
- Finally, in the second dropbox (called country) you must put in the option box the data_reader var setup in your EVENT (see LOAD_COUNTRY_GENERAL) and in advanced tab -> reload event box, the name of the event you create above (for me load_country.. see LOAD_CONTRY_ADVANCED)


I also find a usefull info in this 2 FAQ:
HOW TO RELOAD A FILE
Dynamic dropdown options

Attached you can find also a backup of the form (CAST_RICH_INFO_04_Aug_2017_10_01_37) and the relative DB TABLE (met_chrono_country_list)

You can see the form working here

Hope this help..

LUCA
Attachments
LOAD_CONTINENT_GENERAL.png
LOAD_CONTINENT_GENERAL.png
(21.93 KiB)
263 Downloads/Views
LOAD_CONTINENT_EVENTS.png
LOAD_CONTINENT_EVENTS.png
(11.01 KiB)
262 Downloads/Views
LOAD_CONTRY_EVENT_1.png
LOAD_CONTRY_EVENT_1.png
(12.51 KiB)
260 Downloads/Views
READ_COUNTRY.png
READ_COUNTRY.png
(27.19 KiB)
269 Downloads/Views
LOAD_CONTRY_EVENT_2.png
LOAD_CONTRY_EVENT_2.png
(15.4 KiB)
258 Downloads/Views
met_chrono_COUNTRY_LIST.zip
(6.13 KiB)
48 Downloads/Views
CAST_RICH_INFO_04_Aug_2017_10_01_37.zip
(3.52 KiB)
40 Downloads/Views
LOAD_COUNTRY_GENERAL.png
LOAD_COUNTRY_GENERAL.png
(22.57 KiB)
265 Downloads/Views
LOAD_COUNTRY_ADVANCED.png
LOAD_COUNTRY_ADVANCED.png
(16.55 KiB)
266 Downloads/Views
R
rafaelscouto
Finally it worked, when I changed the Event name on the 3.Setup tab to "load_country", but now ...

The reload event is duplicating the continent and country fields, how can I fix this?
E
erikjo
Luca, it works now also for me.

Thank you so much!

Erik
R
rafaelscouto
How to create a search box above dropdown items equal to this link - https://select2.github.io/examples.html
R
rafaelscouto
After some research without forum, I managed to solve, I added in the dropdown, in the Advanced tab in Extra Attributes "class: search" without quotation marks.

I would like to ask the developer to provide a complete manual, with examples to facilitate the understanding of the tags and fields that the system uses.

The non validation, only allows the use of 15 elements in the Design, which for me is very little, in this case I will have to pay for the use of this component, which is not a problem, because it is fantastic. I have already seen that I will need Connectivity and Director as well, as I will need to list in tables what is registered by the form and manage access types.
admin
Hi,

A very great answer by Luca, thank you!

I have also updated the manual (available in the downloads area) to include information on how to reload a field, it does not explain how to load the options from the database as its explained in the post made by Luca above though.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
C
CSDweb
Is the 'reload' event option available in CC v6.06? I do not see it as an event action for a dropdown field inside a form. I'm trying to have the content of a text field (address) populated/reloaded based up the selection of a venue from a dropdown list but can't figure out how to do it in CC6.
admin
Yes, under "Views > Fields > then field Events"

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
E
erikjo
Dear Luca or Max,

after the most recent update by either Chronoforms6 itself or Joomla, all my forms using the multiple DB dropdown selects cannot be submitted anymore.

The multiple dynamic dropdown select is working (this example: Country and Ground), but if you want to save to the DB or submit the form, nothing happens (no error whatsoever).

Here you can see the form: https://footballflight.de/match-tracker/add-a-ground
Select for example as country Belgium and as Club "Brugge" and try to submit with the "Add the Ground" button.

Tried many different things to find the root cause, but no success.

Any hint would be appreciated.

Thank you,
Erik
E
erikjo
I found a fix, if I add a debugger within the dynamic reload of the Club Dropdown List event block, then it works.

Does someone know, why it works with the debugger the submit but not without?

Thanks a lot!
admin
Hi Erik,
Apologizes for the late reply here!
Did you manage to find why this happens ? I'm not sure without checking the form!
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!