#107979TCA disableNoMatchingValueElement in renderTypes != selectSingle
Description
In a Select-field with renderType=‘selectMultipleSideBySide’ I’m getting no indication when there are invalid items selected in an existing record.
In the docs the property “disableNoMatchingValueElement” is mentioned to be valid for all renderTypes:
https://docs.typo3.org/m/typo3/reference-tca/main/en-us/ColumnsConfig/Type/Select/MultipleSideBySide/Index.html#confval-select-byside-disablenomatchingvalueelement
So my expectation is that “wrong” items are handled in a way like with ‘selectSingle’ (because if the are not handled at all with this renderType, why would the docs mention the option to disable that handling for all renderTypes?).
When searching the source for access to the property “disableNoMatchingValueElement”, I found this function:
\TYPO3\CMS\Backend\Form\FormDataProvider\TcaSelectItems->addInvalidItemsFromDatabase
This function starts with this block:
// Early return if there are no items or invalid values should not be displayed
if (empty($fieldConf['config']['items'])
|| ($fieldConf['config']['renderType'] ?? '') !== 'selectSingle'
|| ($result['pageTsConfig']['TCEFORM.'][$table . '.'][$fieldName . '.']['disableNoMatchingValueElement'] ?? false)
|| ($fieldConf['config']['disableNoMatchingValueElement'] ?? false)
) {
return $fieldConf['config']['items'];
}
If renderType !== 'selectSingle' , the function returns, so it can not work for ‘selectMultipleSideBySide’.
I also do not understand the first part of the condition – why does it also return when there are no entries in $fieldConf['config']['items'] ? If I follow the code correctly, this array holds the valid options. So if it is empty, it’s even more likely that there are non-matching values selected. Maybe the line should read empty($databaseValues) instead? Because if nothing is selected in the DB there can be no non-matching items…
The behaviour is identical in V13.4.19 and an older version (tested on 11.5.41).
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[BUGFIX] TCA disableNoMatchingValueElement in renderTypes != selectSingle Resolves: #107979 Releases: main