4GL Patterns #1 – Select or Add

A common pattern found in database applications is the “Select or Add” pattern.

The pattern allows a user to either

  • select an existing item (usually a foreign key), or
  • to add a new item to the foreign key table, then refresh the combo box, and setting the item to the newly added one

The following is a screenshot from Django’s auto-generated administration screens.
The user is presented with a drop-down box, or a plus icon to add new items to the drop-down list.

Select or Add

Select or Add

The following shows an alternate approach, where an “Add” keyword is added to the bottom of a pick list. This approach can be harder to internationalize.

Other notes

When a new Create Data form is shown to the user, while it may be convenient to make this form modal, so that the parent form can refresh it’s pick list. It may be better to present a non-modal interface so that the user is not blocked from performing other work. This can be done by providing a callback whenever an item is created.

Related Ideas

  • Stable foreign keys
  • Caching


  1. Thanks for the heads up. I had a quick look.
    Pros: build on top of well-known technologies, high level of testability
    Cons: I couldn’t find a spec for the DSL, so it’s hard to evaluate how complete it is.

Comments are closed.