Forums

Dropdown list values based on a table´s records

carcak 06 Oct, 2013
Hi People,

I'm new to Chronoforms. I have been looking through the forum but can't quite get find the answer for my question, maybe someone could point me in the right direction?

I want my form to have a drop down box that lists the values field of a table in my DB. so let`s say I have a table "country" with all countries listed on that table, and I want my drop down box to show all those countries as options for the user to select his country. How do I best do that?


Thanks so much!!!
RobP 06 Oct, 2013
These are the steps

Put a DB Multi Record Loader in your form Events.
1. Select the table were the fields are stored.
2. Give it a Model ID
3. In the advanced tab
4. Select Load Data =Yes
5. Data Load Type = ALL

On the Data Displayer set Enable Date Displayer to No

If you want to display then in alphabetical order Put the following code in the Where statement: 1 ORDER BY 'the_field_to_be_displayed'
The 1 and the single quotes are necessary.

Next put a Drop Down on you form.
1. Give it the appropriate fieldname of your dataset (loaded with a DB Record loader, not the DB Multi Record Loader). The syntax is ModelID[fieldname]
2. Select the Dynamic Data tab
3. Enable = Yes
4. Data path is the Model ID of the fields to be shown (form the DB Multi Record Loader)
5. Value key is the field you want to be stored in you table
6. Text Key is the field you want to display


Rob
carcak 08 Oct, 2013
Rob: Thank you very much!! Your step by step explanation was very clear and my form is working!!!!
This topic is locked and no more replies can be posted.