Buy Now
Sign in

load data in a dropdown from the database

zetap , February 06 at 20:41
Z
zetap
Hello​
​​
​I am creating a form that includes a dropdown, which I must dynamically load from a table in the database. ​
​I need that the "Title" of each option of the dropdown, load a field of a record of the table in the database and ​
​that the "Value" of the same option of the dropdown, load another field of the same record of the table of the database.​
​I have reviewed the frequently asked questions and there are examples of V4 and I have not been able to replicate it in V5,​
​also check the forum, but I do not know why I can not see the answer to many of the existing entries.​
​​
​Could you help me solve it?​
​​
​Thank you very much !
GreyHead
Hi zetap ,
How are you loading this data? If you use a DB Read action and specify these two columns that you should get the data array that you need.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
Z
zetap
Hi Bob, thanks for your response.​
​​
​According to what you answered, I checked again and had not understood that Model ID was the name of the array where the fields of the table are loaded.​
​​
​Now, I would need to load the value of the dropdown in a textbox, which loads dynamically, according to the option that the user chooses in the dropdown. I imagine that it should be done by creating an event in the dropdown, but I can not get it to work.​
​​
​Can you explain me ?​
​​
​Thank you very much, greetings!
GreyHead
Hi zetap,
I'm not clear what you need to do here? The value of the drop-down will be submitted with the form data so is available without using a second input.
If you need to show it twice then you can use JavaScript (or an event) to set another input to show the selected value.
Are you sure it is the value that you want to show and not the text?
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
Z
zetap
Hello Bob,​
​​
​I tell you what I need to do, I have a table in the database with data from several companies, id and other data, in a form, I need to load a dropdown with data from that table, id = value and name = text, so that the When selecting a company from the existing ones, use the value of the dropdown to pass the parameter to another form where you load all the company's data and add information in other empty fields of the table, that's why you wanted to load the id in a textbox that then send by parameter​
​​
​I hope you can understand my explanation.​
​​
​Thank you very much, greetings!
M
mrusciel
check this link and try ... this works for me... i have CFv6
Z
zetap
Hello mrusciel, thanks for your comment​
​​
​Anyway, the problem of loading information from the database to the drop-down has already been solved, my unsolved problem is how to take the value of the option selected in the drop-down and load it into a text-box in the same form.​
​​
​Also the form is made in V5 chronoforms and it is quite complex to migrate it.​
​​
​Greetings, thank you very much!
GreyHead
HI zetap,
I guess that you can write JavaScript to copy the value of a drop-down selection to another input box.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
Z
zetap
Hello Bob, thanks for answering​
​​
​I really do not have almost experience in JavaScript, you would have an example.​
​​
​Arovecho and made another query, I do not remember if in the forum or in the frequently asked questions, I read about how a form could receive a parameter in the url and load it in a field of the form, the problem is that it does not save that information and now nola encounter, can you help me by indicating how it could be done?​
​​
​Thank you very much !...