2nd Dropdown with Ajax does not populate with CF5

erikjo 25 Feb, 2017
Hello,

first of all, I got it working once, but now after trying to get it to work again for about 12 hours over the last couple of weeks, it does not anymore. I am using two dynamic dropdowns populated by two different DB tables. The second dropdown (list of competitions of each country) should be populated based on the value selected in the first dropdown (list of countries).
Link to one of my test forms

I read several FAQs and tutorials on your sites, including the as it seems the most recent one:

I cannot spot the difference to my set-up, I also started over and over again and even tried to create a new set of tables to eliminate any stupid DB issues.

Many thanks and regards,
Erik
GreyHead 25 Feb, 2017
Hi Erik,

Instead of using '' for the Empty selectio, please just leave the box empty - at present your Javascript ends up with
if($("[name='choose_country']").val() != "''"){

Bob
erikjo 25 Feb, 2017
Hi Bob,

thank you, now I set both = and != with no value and the empty option is working, but it does not populate a list, if you select a value.

Any advice?

Regards,
Erik
GreyHead 26 Feb, 2017
Hi Erik,

The URL being used for the AJAX call is /chronoforms5?choose_country=xx which doesn't connect to the form Ajax event. It needs to be /index.php?option=com_chronoforms5&chronoform=form_name&event=event_name&choose_country=xx&tvout=ajax

Bob
erikjo 27 Feb, 2017
Hi Bob,

thanks, this is probably caused by JoomSef, does it mean that I cannot use JoomSef URLs, where I use Ajax triggered chronoforms?

Regards,
Erik
GreyHead 27 Feb, 2017
Hi Erik,

If JoomSEF is creating URLs that don't work that is clearly a problem. Can you disable it for ChronoForms and see if the AJAX calls then work?

Otherwise you could use Custom Code to create the AJAX calling using a menu item to avoid the problem with JoomSEF.

Bob
erikjo 27 Feb, 2017
Hi Bob,

thanks a lot - I disabled in JoomSef Extension the handling for Chronoforms and it seems to work for one of my forms: http://footballflight.de/test/add-a-club Let's see, if this is coincidence or it solved all issues with Ajax. Even though it still works with the JoomSef URLs.

Fingers crossed, I get back to this thread, if I experiencing again issues.

Regards,
Erik
erikjo 19 Mar, 2017
Hi Bob,

this works perfectly now, the only issue I experience is that the 2nd dynamic dropdown does not order by the field I defined in my DB_Read action at the Order parameter. It always orders by the default ID field.

Do I need to put the order by somewhere in the php code within the CustomCode action after the DB_Read action within the ajax event container?

Thanks and regards,
Erik
GreyHead 19 Mar, 2017
1 Likes
Hi Erik,

I think that the ordering should work with a custom Axax event. Please post a link to the form so I can take a quick look.

Bob
GreyHead 19 Mar, 2017
1 Likes
Hi Erik,

This is a ChronoForms 'bug' :-( There is a fix in this post but it requires a small hack on the ChronoForms code.

Bob
erikjo 19 Mar, 2017
Hi Bob,

thanks a lot, I applied your fix and it works now!

I bought you a coffee.

Cheers,
Erik
GreyHead 20 Mar, 2017
Hi Erik,

Thank you, much appreciated.

Bob
erikjo 31 May, 2017
Hi Bob,

I updated CF5 to the latest version and increased the PHP version of the Joomla site, but have not changed anything in the form config, but now all ajax populated 2nd dropdowns in all of my forms are showing as values just [object Object] instead of the correct values from the database table.

Do you know, what can cause this behavior?

http://footballflight.de/match-tracker/add-a-club

btw: Would also straight away build those forms with CF6, but have not found any instruction similar to the CF5 forms, how to build 2 dependent dynamic dropdown, is there any thread to read through?

Thanks a lot and regards,
Erik
erikjo 07 Jun, 2017
Hello,

nobody got an opinion about that topic?

Thanks and regards,
Erik
GreyHead 08 Jun, 2017
Hi erikjo ,

I'm unable to open the site from here - I just get a blank page and a a spinning disk in my browser tab.

Bob
erikjo 08 Jun, 2017
Hi Bob,

really, for me the link works fine also after deleting all of my browser cache.

I attached a screenshot of my issue, how the ajax dropdown looks like, it seems to retrieve the correct number of dropdown value items, but missing the correct lables.

Can you please give that link a try http://footballflight.de/match-tracker/add-a-match

Thanks and regards,
Erik
This topic is locked and no more replies can be posted.