How do I have one drop down list's choices determine the choices available in another drop down list?
In a recent release of QuickBase, we introduced a new way of creating conditional dropdowns. Click here for details: https://www.quickbase.com/help/conditional_dropdowns.html
You can still choose to follow the instructions below.
_______________________________________________________________________________________
This is a commonly asked question and the best answer is that, when using QuickBase, there is a better way to accomplish this than using dropdown lists whose content depends on the selection in a previous dropdown list.
The first step is to, within an application, create a table for each connected dropdown list. For illustrative purposes in this article we will use a dropdown list of car makes and dependent dropdown list of car models. The idea being that a user first chooses among a list of car makes (Ford, Chrysler, Mercury, Chevrolet, etc.). Then the models drop down list would display only the models (Mustang, Taurus, Escape, Explorer, etc.) associated with the chosen make.
In this example we would create a two tables:
First, create a Makes table with at least one column labeled "Make". Set the singular and plural form of the noun for this table to "Make" and "Makes". Configure the Record Picker for the Makes table to display the Make field (https://www.quickbase.com/help/specify_record_picker_fields.html). Here it probably also makes sense to set the key field of the Makes table to be the Make field (https://www.quickbase.com/help/setting_the_key_field.html). There should be only one record in this table for every Make.
Next, create a Model table with at least one field labeled "Model". Set the singular and plural form of the noun for this table to "Model" and "Models".
Then you'll need to create a relationship between the Makes and Models tables where the Makes table is the master table and the Models table is the details table. Allow the relationship wizard to create a reference field for you. If the key field of the Makes table is the Make field then the reference field in the Models table will be a field called "Make" containing the Make of the master record. If the key field in the Make table was left to be the built-in field Reord ID# then create a lookup field in the Models table for the "Make" field.
Click the "Models" table and select Customize the models table > Properties. On the left side of the Properties tab, click Record Picker fields. Configure the Record Picker for the Models table to display both the Make and Model field.
Fill up the Makes table with all the makes. Then fill up the Models table making sure to choose a Make for each model.
Now let's imagine that in a third table, within the same application, called Customers, you want to record the customer's make and mode of automobile. To accomplish this you would create a master-detail relationship between the Models table and the Customer table. While creating the relationship make sure to create two lookup fields in the Customer table for make and model.
Once you have created this relationship you'll have a reference field called Model. In edit mode this relationship field presents itself as dropdown list of all the valid make and model combinations. If you've configured the record picker in the Models table to display the make column first, then the entries are sorted first by make and then by model. If you present the model column first in the record picker then the drop down list is sorted by model.
This can actually be easier to use than two dropdown lists. For example here's how conditional dropdown lists are harder to use. Someone may know that they drive a Sable, but they think that their car's make is Ford. They choose Ford from the Make dropdown list. Then they don't see the Sable choice in the Model dropdown list. So now they have to choose each Make in the first drop down list and hunt through the models until they find Sable. Presenting all the choices at once is actually more straight-forward.
The properties of a reference field allow you to choose between one of two record pickers. The default record picker is just a dropdown list. The pop-up record picker is a separate window that displays up to 200 choices. It has next and previous buttons to navigate to additional choices. Reference fields have a property called:
"On add/edit forms use the Record Picker rather than a drop-down menu"
If this checkbox is checked, in all cases the pop-up record picker will be used. The pop-up record picker has search capability built-in so that someone could search for the word "Sable". The search function in the pop-up record picker searches all columns displayed in the record picker. This makes it easier to find the choice you're looking for if there are alot of choices. The pop-up record picker is used in all cases if the number of records in the master table is 500 or more.
Once the user saves the record, you can present the Make and Model as separate fields using the two lookup fields that you created while using the relationship wizard. You should present the reference field only when a form is being used for adding or editing a record. The opposite is generally true for lookup fields. Lookup fields should only appear on a form when it is being used to display records, not when the form is used for editing or adding records.
In conclusion QuickBase's relationship capability allows you to accomplish the functionality of conditional dropdown lists without any of their drawbacks.
If you still really want to know how to do conditional dropdown lists, and you're willing to hack JavaScript and HTML then please read the following article:
https://www.quickbase.com/db/6mztyxu8?act=DBpage&pagename=conditionaldro...
- Printer-friendly version
- Send to friend
- 3780 reads



Comments
Post new comment