Options

Writing the allowed answers for Select and MultiSelect fields: the bilingual option editor, how a submitted value is matched, and what adding, renaming or removing an option does to records that already exist.

A Select or MultiSelect field carries its own list of allowed answers. The list belongs to the field — there is no shared list reused across several fields — and it is written on the definition form, in the Options box that appears as soon as you choose either of those two value types. Both types use exactly the same list and the same editor; the only difference is that a MultiSelect answer can hold several entries from it at once.

The options editor

Options are edited as a list of rows rather than as free text. Each row is one option.

  • Add option adds a row at the end of the list.
  • Each row takes an English label and an Arabic label.
  • Remove option deletes a row.
  • Row order is the order the options are offered in on the record form, top to bottom.
  • An empty list shows a prompt to add the first option — a Select field with no options cannot be saved.

The two labels are stored as two parallel lists, matched up row by row. An Arabic reader sees the Arabic label; the answer written onto the record is the English one either way. Leaving an Arabic label blank is allowed, and that option then shows its English label to everybody.

A worked example

A shirt-size field on a Select type, with three options. The right-hand column is what actually lands on a record.

English labelArabic labelStored on the record
SmallصغيرSmall
MediumمتوسطMedium
LargeكبيرLarge

An Arabic-reading user picking متوسط stores Medium, exactly as an English-reading user picking Medium does. Both see their own language on the way in and on the way out; the data underneath is one consistent value.

How a submitted value is matched

The submitted value is trimmed, then compared against the English labels exactly. The comparison is case-sensitive. Using the three options above:

Submitted valueWhat happens
MediumAccepted, and stored as Medium.
" Medium" with a leading spaceAccepted. Both sides are trimmed before comparison, so surrounding spaces never cause a spurious rejection.
mediumRefused: VALIDATION_INVALID_FORMAT. Case matters — which also means Medium and medium can legitimately coexist as two separate options if you really want them to.
متوسطRefused if submitted directly to the API: only the English labels are matched. Choosing متوسط in the interface works normally, because the interface submits the English label behind it.
Extra-LargeRefused: VALIDATION_INVALID_FORMAT, with a message quoting both the rejected value and the field's key.
A blank valueTreated as empty: stored as cleared on an optional field, refused with VALIDATION_REQUIRED on a required one.

MultiSelect specifics

MultiSelect reuses this same list and this same editor. What differs is the value: several answers at once, in the order they were picked, up to a hard ceiling of 19.

Submitted valueWhat happens
Blue, then Red — on a field whose options list Red before BlueAccepted, and read back as Blue then Red — the order picked, not the order the options were listed in.
Removing one selection from threeAccepted. Removing one selection leaves the others in their existing relative order.
A twentieth selectionRefused: VALIDATION_MAX_LENGTH, naming the ceiling of 19. The picker makes every unselected option unpickable once you reach 19, and shows a live "N of 19 selected" counter, so this is normally unreachable from the interface.
The same option selected twiceRefused: VALIDATION_UNIQUE. A repeated selection is rejected, not collapsed.
An explicitly empty listTreated as empty, exactly as a blank scalar is for every other type: cleared on an optional field, refused on a required one.

Changing the list later

The options list is editable at any time. Because the option text is the stored answer, some edits reach backwards into records that already exist and some do not.

EditEffect on records that already exist
Adding a new optionNone. Existing answers are untouched; the new option simply becomes available.
Renaming an English labelEvery record already holding the old text now displays the new text. Nothing is migrated and nothing is lost, because the option row is what the record points at — but the answer people see has changed under them.
Removing an optionRecords already holding it keep their stored answer and keep displaying it. The option is no longer offered to anybody new, and the next time somebody edits one of those records they will have to choose a different answer to save it.
Reordering the rowsChanges the order the options are offered in. It does not change any stored answer, and it does not reorder an existing MultiSelect answer, which keeps the order it was picked in.
Changing only an Arabic labelDisplay only. The stored answer is the English label, so nothing about the data changes.

Option errors you may see

SituationWhat you see
Saving a Select or MultiSelect field with an empty listRefused: options are required for Select fields.
Options supplied on a type that does not take themRefused: options are only allowed for Select fields.
A value that is not one of the optionsRefused: VALIDATION_INVALID_FORMAT, quoting the value and the field's key.
More than 19 MultiSelect selectionsRefused: VALIDATION_MAX_LENGTH, naming the ceiling of 19.
The same MultiSelect option twice in one saveRefused: VALIDATION_UNIQUE, quoting the repeated value.

What the options list does not do

Three things people reasonably ask for, and what the answer is today.

  • Reusing one list across several fields means attaching an Option Set, rather than typing the same options into each field. A field's own options and an attached Option Set's options can both be in play at once — the field just does not automatically pick up an Option Set's later edits unless it is re-attached.
  • There is no colour, icon or code per option that you can set. The label is the whole option as far as the definition form is concerned.
  • There is no ceiling on how many options a list may hold, but a MultiSelect answer still cannot select more than 19 of them.