User-populated tables: addbutton & removebutton

What you'll be learning:

  • How to use the addbutton and removebutton controls to let your users add or remove rows from a tabular control such as a table or repeater

  • How to use multiple if elements to streamline your code

A typical truck has much more parts than you can list in a form that lives on a mobile device screen. Any of the parts can have problems, and you want to let the Rocky Jupiter truck drivers report all of the problems they find - even if you don't list the problematic part in the form.

The solution is to let the driver add faulty parts to the list. You'll accomplish this by offering the user a drop-down menu to select an optional car part that she can then append to the checklist.

What you'll be building: the user can select and add a new car part to the list

Figure 79. What you'll be building: the user can select and add a new car part to the list


Because you don't want to overcomplicate your code or have to manage a second reference table for the optional parts, you will slap its data into the parts.xlsx input data spreadsheet and include a helper variable and multiple conditional statements to sort it out without additional form controls.