Feature #60908
openProvide Evaluation of TCA select fields
0%
Description
Currently, it is not possible to require a (single) select field as mandatory, meaning non-empty or required in TCA. An "eval" property simply does not exist and is ignored if given.
Example:
'owner' => array( 'exclude' => 1, 'exclude' => 0, 'label' => 'Owner', 'config' => array( 'type' => 'select', 'foreign_table' => 'tx_myext_domain_model_owner', 'size' => 1, 'autoSizeMax' => 30, 'items' => array( array('', ''), ), 'maxitems' => 1, 'minitems' => 1, 'multiple' => 0, 'eval' => 'required,notEmpty' ), ),
That is really lame :-) A CMS must provide at least basic evaluation options for all input types.
Files
Updated by Benjamin Rau about 10 years ago
I agree, you can only work around this actually by forcing the select to multiselect (size>1).
Beeing able to make a single select with empty default option mandatory is a must have for me, too.
Updated by Anonymous about 10 years ago
+1
I think this feature should be a must have for TYPO3.
Updated by Martin Sonnenholzer about 10 years ago
+1 I had that problem a few times
Updated by Felix Kopp over 9 years ago
- Tracker changed from Bug to Feature
- Category changed from Backend API to FormEngine aka TCEforms
Updated by Krzysztof Napora over 7 years ago
‘minitems’ => 1,
‘maxitems’ => 1,
‘eval’ => ‘required’,
Updated by Gernot Ploiner over 1 year ago
What you are looking for is:
...
'items' => array(
array('Please choose', 0),
),
'eval' => 'required'
...
This works, but it shouldn't. Because eval is not a setting for type=select.
See: https://docs.typo3.org/m/typo3/reference-tca/10.4/en-us/ColumnsConfig/Type/selectSingle.html
And there is a Bug combined with 'onChange' => 'reload'. See: https://forge.typo3.org/issues/94050
But this is a needed missing feature. Without, it is not possible to make a selectSingle with a "please choose" entry, which is required.
The Setting 'minitems=1' without "please choose" will work, but then you have one of the otions preselected. You cannot force the Editor to select an option.
The workaround with 'multiselect>1' is not beautiful.
Tested in TYPO3 10.4.
Updated by Sybille Peters over 1 year ago
- Related to Bug #94050: Do not reload form on change if mandatory fields are not filled in added
Updated by Sybille Peters over 1 year ago
- Related to Bug #99153: Discrepancy between behaviour and documentation for "eval" property in "select" fields in TCA added
Updated by Gernot Ploiner over 1 year ago
- File tcademo.zip tcademo.zip added
I attached a small extension for TYPO3 11.5 (there is the same behavior as in 10.4) to easyly reproduce the two related problems:
Installation:Install the extension: ddev composer require webprofil/tcademo:@dev
In the TYPO3 Backend:
- create a regular page (e.g. uid=1)
- create a folder in the pagetree (e.g. uid=2)
- create a fegroup at the folder
- create some feusers at the folder
- create a 'Dummy' record at your page or folder
Now you can see the problems:
- Before you save, change the select "Type" to "Type 1". Then reload (click "yes"). This errormessage apperars, because "Employee" is not filled out:
"2: SQL error: 'Incorrect integer value: '' for column `db`.`tx_tcademo_domain_model_dummy`.`employee` at row 1' (tx_tcademo_domain_model_dummy:NEW63830ddb4a18d611387331)" - The "Employee" select is displayed as I expect. But as I know, the TCA-property 'eval' => 'required' is not allowed (and not documented) at TCA select / selectSingle. Without eval, it is not possible to make a selectSingle required with a "pleasechoose" option.