#111518Add placeholder option for TCA select fields with renderType selectSingle
Description
Single select fields have no supported way to make editors choose a value explicitly.
The usual workaround is an empty item like [‘label’ => ‘Please choose’, ‘value’ => ‘’] (or 0), but it has problems:
- The empty item can be selected and saved like any other value.
- With integer items, 0 often stands for “nothing selected”, although it can also be a real value.
- An empty string item turns an integer column into VARCHAR when the column is generated automatically.
- Setting ‘required’ => true on a select field is not documented. It only works in the browser and is not checked by DataHandler.
Proposal: a new option placeholder for type => ‘select’ with renderType => ‘selectSingle’:
‘config’ => [
‘type’ => ‘select’,
‘renderType’ => ‘selectSingle’,
‘placeholder’ => true, // or a label like ‘my_ext.db:field.placeholder’
‘items’ => [
[‘label’ => ‘Zero’, ‘value’ => 0],
[‘label’ => ‘One’, ‘value’ => 1],
],
],
- true uses a generic label provided by TYPO3 (“Please choose”). A string is used as a custom label.
- FormEngine renders the placeholder as the first option. It is shown while no value is chosen, but editors cannot choose it, so the field is required.
- DataHandler rejects an empty value for such fields. 0 stays a valid value.
- An automatically generated column for integer values (integer items or foreign_table) becomes nullable with default NULL. A record without a chosen value can then be told apart from 0. String fields keep their VARCHAR column.
- Multi-value select fields are not affected; they can use minitems to require a selection.
Reviews 1
Related issues 1
History 12
-
Gerrit Code Review pushed patch set 1 for main to change 97861 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-20T15:10:16+00:00" > 11/20/26, 15:10 </span> -
Nikita Hovratov changed Related to #60908 <span data-processor="relativetime" data-value="2026-11-20T15:10:40+00:00" > 11/20/26, 15:10 </span>