Sometimes it is convenient to allow users of your Qrimp application to filter the items in one select box by choosing an item in another select box. For example, when choosing to examine fuel economy by vehicle, because there are hundreds of different types of cars, you could let your users filter by Make, and then show only the particular models for that make in another box.
In this Help Topic, we will use another example that fits with our Campaign Contributions system, where when choosing a candidate to add a contribution for, you can filter the list by the candidates party. We'll end up with a dependent select box like the image below:
Here is a video that shows the dependent select boxes in action:
To get started, we will first go to the Add New screen for the Contributions. Notice the default select box has only a list of candidates:
From the add new screen for contributions, select Design > Field Templates:
Next, we will click the edit icon for the Candidate column. Since we have not modified the template for this field yet, Qrimp has created one for us automatically that looks like this:
To add a select box for Parties that will filter the candidates list, we will edit the field template to look like this:
Notice we have inserted this block of text before the Candidate select box:
This tells Qrimp to create a select box that will filter the Candidate select box and show only those candidates where the party is equal to the party we select in the Parties select box.
If we want to hide the Candidates select box until a selection in the Parties select box has been made, we can use code like this:
[select:Parties:Candidateparty] then Candidate
The span indicated with the id Candidate_selectbox
is the location where Qrimp will display the list of candidates in the party that we choose in the Parties box. This example behaves like the video below:
Your final output should be in this format:
The code above is telling Qrimp to display a SELECT box with data that is used to filter another select box that ultimately has the list of items of which one is the desired selection for the field in this table.
So for example, if you are creating a trouble ticket system for equipment and have 100 pieces of equipment, each with an EquipmentType and you want to make it easy for your users to select just one piece of that equipment, you'd use a command like the following:
then Piece of Equipment