Set up dropdown dependencies

A quite common need is to have separate sets of items in a dropdown field based on the selection made in another dropdown. A good example for this is the Car Make >> Model type of scenario, where the frontend user can first select a car manufacturer (in the first dropdown) and will then be presented with all of the manufacturer's available models (in the second dropdown).

RSDirectory!'s dropdown fields include this feature by default. Here's how you can implement the aforementioned example:

Car Make >> Model

This scenario requires 2 separate dropdowns:

 

1. The Car Make dropdown

This field does not require any special configuration, it will simply contain all the available car manufacturers:

  • Head to Components >> RSDirectory! >> Fields >> click on New
  • Set up the field's internal name (in the Name field, mandatory). Let's assume that the field will be named make
  • Provide the list of manufacturers, in the Items text area. There are 2 ways in which you can do this, depending on your needs:
  • The item's value is different from its caption

    audi|Audi

    alfa romeo|Alfa Romeo

    ...

    The item's value and caption are equal

    Audi

    Alfa Romeo

    ...

 

2. The Model dropdown

This field's configuration will require some additional steps:

  • Head to Components >> RSDirectory! >> Fields >> click on New
  • Set up the field's internal name (in the Name field, mandatory). Let's assume that the field will be named make
  • This is where the Dropdown Dependency feature comes in. In the Dependency field (where all available drop-downs will be listed), select the make dropdown.
  • A new dropdown, called Dependecy value, will be added to the layout. It will contain the make field's items. Select it's first item (the first manufacturer).
  • Provide the list of models that are associated with the selected manufacturer, in the Items text area.
  • Repeat the process for all manufacturers available in the make field.
 

An implementation of the same example provided above can be found on RSDirectory!'s dedicated demo website (choose Vehicles in the - Select Category - dropdown after clicking the link).

RSDirectory! demo website's administration area

 

Was this article helpful?

Yes No
Sorry about that