Buy Now
Sign in

Dynamic dropdown from multiple table

bubila , December 27 2017
B
bubila
Hi there, I'm trying to create a form with two dropdowns where the second field is loaded after the first one is selected. The data of the second dropdown should be loaded from two tables ( I need to display all destinations that has the same pickup location). I really cannot understand how to make it work, how can I load data from two different tables? moreover I tried at first something simpler, loading data from just one table but when I put the variable to use in the where clause I keep on getting an error that the field does not exists even if that is not the case. I tried to search for some example but couldn't find one anywhere.
Can you please advise how to do so?
thanks!
Elisa
elisa
admin
Hi Elisa,

Please try to access the event which is used to reload the dropdown using the browser (form link + &event=event_name), what do you get ?

You may also post a screenshot of your read data settings.

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!
B
bubila
Hi Max, as a matter of fact when I try to access the form via the VIEW FORM link I cannot even see the first dropdown working however when I use the Preview button the first dropdown works correctly but when I select a location from it the second drop down keeps on loading and the Chrome console shows this error:
Error: 1054 Unknown column 'tratte.id_from={data' in 'where clause' . Id_from is actually a column in the database so I guess I'm doing something wrong, but I cannot guess what that is. This new CF is so different from CF4 and I'm actually struggling to understanding how some features work. I thought I had to add a module in the read data action to retrieve data from multiple table but when I try to add it and click on the new module nothing happens
Do you have a clue on what I'm doing wrong? It could be useful to have an example on how the double dynamic dropdown works. Thanks a lot
elisa
elisa
admin
Hi Elisa,

The field name error is because you are using "=", you should use this:

tratte.id_from:{data:field_name_here}


In order to get the data from multiple tables you will need to add an extra model in the "read data", if this does not work then please let me know the error in the browser's console.

There is a "dynamic dropdown" demo form in the forms manager, did you check it ?

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!
B
bubila
HI Max,I've checked the dynamic dropdown example but it is not what I need
I knew I was just doing something wrong,I fixed the error and now I will have to try to use multiple modules but when I try to add a new module in the read data action, what happens is that I cannot see the specifics of the new model, long story short I add the module, then click on the name of the module in the black bar and nothing happens, I see the same data of the other module, and there is no way I can delete the module I don't need or change the table ecc..
No errors anywhere
I'm sorry I keep on bothering you with that! Thanks again for your time
Elisa
elisa
B
bubila
HI Max do you have any idea why the module does not work? I cannot make it work
Or should the modules work as specified above? if so is there an example I can follow to learn how to use them?
thanks a lot
elisa
elisa
admin
Hi Elisa,
Apologies, I have just read your reply now!
you still have this problem or you could solve it ? you can not open the new model area ?
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!
B
bubila
Hi Max
nope, no way I can solve this, I moved the site onto another server with different specifics and a newer PHP version but when I try to add a new module nothing happens.
I also take the chance to ask you if there are problems with CF4 and PHP7, on one website I saw something a little strange, it has been working for 10 days now, and suddenly I had to switch back to php5.6 since all forms in CF4 were empty (in the actions section - all set as if everything was working but when trying to update an action the forms was empty).The strange thing is that it happened only on one webiste
Thanks
elisa
elisa
admin
Hi Elisa,
v4 may have issues on php7 but its outdated and I'm not aware of all the issues, I recommend using v6 on new websites.
Regarding the model problem you have, it should be fixed in the latest update.
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!
admin
Hi Elisa,
The latest v6 update fixes the model screen issue, please update yours and check that if possible.
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!
B
bubila
Sorry I got back to you so late, Sure I'll check , but for the time being I wont' be using CF6, I'll stick to CF4, high season for our business is starting, so too risky to try something new thanks
elisa