Forums

Populate a dropdown field with data out of a database table

JoCo 12 Sep, 2019
In demo form "Dynamic dropdown" there is an example how to populate a dropdown.
What i am looking for is an example how to populate a dropdown with data from a database. That data must depend on the value of another dropdown.
In V5 is that possibility in dropdown under the tab "Events". So how i build the same "Event" in V6.
Max already helped me by pointing me to that deform "Dynamic dropdown".
I hope someone can give me an example how to do it, if possible with screenshots.
Kind regards, Jos
healyhatman 12 Sep, 2019
Make sure your events are set to "standalone" and that "auto display view is turned off, and that your read data action is set to "return an array of key/value pairs"
JoCo 13 Sep, 2019
Thank you healyhatman for your quick respons but i already knew those things .
I am looking specifically for how you create one dropdown that triggers a procedure to extract data, dependent on the value of that dropdown, from a database table and populate that data in a second dropdown. So, what items i must fill in in both dropdowns.
healyhatman 13 Sep, 2019
Same way the other dynamic dropdowns work pretty much. Instead of the PHP array you use the database read. Post a screenshot of what you have if you can't get it working
JoCo 13 Sep, 2019
I'l try to send you a backup from that form but i can't attach it. The option "File Upload" asks for a "url" and i don't what to fill in.
JoCo 13 Sep, 2019
Hello healyhatman,

i am just a little bit further again. My previous reply is, i think, not necessary anymore. I have now something in my dropdown but not the data i want. Is see three times the word "Array". So, i think there must there must still something (formatting?) te be done. You can tell my what. The content of the array is correct. That is see in the debug screen.
healyhatman 13 Sep, 2019
Answer
Have you set it to return an array of key value pairs
JoCo 13 Sep, 2019
Thank you healyhatman. It works. I'am deep a shame.
That was the solution. In a previous form i did the right setting.
Tiil next time.
This topic is locked and no more replies can be posted.