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 label | Arabic label | Stored 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 value | What happens |
|---|---|
| Medium | Accepted, and stored as Medium. |
| " Medium" with a leading space | Accepted. Both sides are trimmed before comparison, so surrounding spaces never cause a spurious rejection. |
| medium | Refused: 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-Large | Refused: VALIDATION_INVALID_FORMAT, with a message quoting both the rejected value and the field's key. |
| A blank value | Treated 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 value | What happens |
|---|---|
| Blue, then Red — on a field whose options list Red before Blue | Accepted, and read back as Blue then Red — the order picked, not the order the options were listed in. |
| Removing one selection from three | Accepted. Removing one selection leaves the others in their existing relative order. |
| A twentieth selection | Refused: 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 twice | Refused: VALIDATION_UNIQUE. A repeated selection is rejected, not collapsed. |
| An explicitly empty list | Treated 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.
| Edit | Effect on records that already exist |
|---|---|
| Adding a new option | None. Existing answers are untouched; the new option simply becomes available. |
| Renaming an English label | Every 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 option | Records 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 rows | Changes 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 label | Display only. The stored answer is the English label, so nothing about the data changes. |
Option errors you may see
| Situation | What you see |
|---|---|
| Saving a Select or MultiSelect field with an empty list | Refused: options are required for Select fields. |
| Options supplied on a type that does not take them | Refused: options are only allowed for Select fields. |
| A value that is not one of the options | Refused: VALIDATION_INVALID_FORMAT, quoting the value and the field's key. |
| More than 19 MultiSelect selections | Refused: VALIDATION_MAX_LENGTH, naming the ceiling of 19. |
| The same MultiSelect option twice in one save | Refused: 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.