Forums

Selecting options from a database

vampmaster 12 May, 2014
Hello all:
I have a table that holds all the locations for my hospitals. The hospitals tent to increase in numbers. In my contact form and my make an appointment form i can select the preferred hospital. Each time a hospital is added or eliminate form my hospital list i also have to a manually edit all the forms.I would like to know if there is a way so that the select field for choose a hospital autopopulates with the name of the hospitals that are with status 1 in my hospital table. I know in normal circunstances i query the table and perform a do while in the select on the html but not sure if this wolud work in chronoforms or if there is an easier way to achieve this.

Sincerely
Elliot J. Balanza
chriso0258 12 May, 2014
Hello,

I don't know if this helps but in your forms component, if you click on the button in the right corner that says Demos, it will create some demo forms for you. One of which is called, "demo-dynamic-dropdown". You can use this as an example of how to create one for your needs. Essentially, it allows you to link your drop down list with your database so that your list dynamically updates itself as your db does.

Regards,
Chris.
GreyHead 13 May, 2014
Hi Elliot,

I agree with Chris and please see this FAQ for more information. The FAQ was written for CFv4 but the same methods work with CFV5.

Bob
This topic is locked and no more replies can be posted.