v5 Dynamic Dropowns with default (selected) value

ru russelln 20 Jan, 2015
Hi,
I have created a dynamic dropdown pair (Country and State). The dropdowns and ajax work fine in that the I select a country and the states for the country are loaded.

The application is reading the users profile data and should show the country and state that was previously saved to their profile. The country works fine, but the state dropdown never uses the value that has been sourced from the database. I suspect this is the ajax dynamic calls to the State field mean it never honours the value set to the field?

If I change it so the State dropdown is just a static list of every state in the world (with the ids) when the page loads it does select the correct state. When I have the Country table dynamically load the State table it just selects the first state at the top of the list.

I attempted to put some Javascript in to set this but want to make sure before I head down a customisation path, is this correct?

Thanks,
Russell.
Gr GreyHead 21 Jan, 2015
Hi Russell,

I think you are on the right track, ChronoForms isn't clever enough to handle this situation.

I seem to remember that setting a JavaScript variable in the On Load event, then re-creating the second drop-down and setting the value will work.

Bob
ki kiwiup 16 Feb, 2015
Hi Bob,
please may you show to me what is the js code to obtain this task "setting a JavaScript variable in the On Load event, then re-creating the second drop-down and setting the value will work. " that you nentioned above?

Thanks in advance.

Kiwiup
Max_admin Max_admin 20 Feb, 2015
Hi,

If there is a "db read" loading the dropdown options BEFORE the HTML then the stored value should be auto selected when the form is loaded.

Regards,
Max
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.