Forums

2 dynamic dropdonw based on DB table

giacall 16 May, 2017
1 Likes
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
Max_admin 17 May, 2017
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giacall 23 May, 2017
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
Max_admin 24 May, 2017
1 Likes
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giacall 07 Jun, 2017
1 Likes
Hi Max.
Sorry for the delay on reply.

Now the form work fine...
Thank's

LUCA
erikjo 31 Jul, 2017
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
giacall 31 Jul, 2017
1 Likes
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
rafaelscouto 01 Aug, 2017
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
erikjo 02 Aug, 2017
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
giacall 04 Aug, 2017
Answer
2 Likes
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
rafaelscouto 07 Aug, 2017
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?
erikjo 08 Aug, 2017
Luca, it works now also for me.

Thank you so much!

Erik
rafaelscouto 08 Aug, 2017
How to create a search box above dropdown items equal to this link - https://select2.github.io/examples.html
rafaelscouto 09 Aug, 2017
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.
Max_admin 13 Aug, 2017
1 Likes
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
CSDweb 23 Dec, 2017
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.
Max_admin 27 Dec, 2017
Yes, under "Views > Fields > then field Events"

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
erikjo 04 Jan, 2018
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
erikjo 04 Jan, 2018
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!
Max_admin 17 Feb, 2018
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.