Bug #105513
closedFormengine validation in Filelist / Missing processedTca 'config' entries
0%
Description
Apart from editing records in the "usual" FormEngine habitat, in the filelist module a similar FormEngine-based view is available to edit sys_file_reference records for example.
Patching (or overriding) typo3/sysext/core/Configuration/TCA/sys_file_reference.php
by inserting 'required' => true
to the fields title
and description
will lead to the displayed fields getting formengine attributes for validation:
<input type="text" id="formengine-input-6720c4b80d013783152706" class="form-control form-control-clearable t3js-clearable" data-formengine-validation-rules="[]" data-formengine-input-params="{"field":"data[sys_file_metadata][17169][title]"}" data-formengine-input-name="data[sys_file_metadata][17169][title]" placeholder="test.form.yaml" data-formengine-input-initialized="true">
<textarea id="formengine-textarea-6720c4b80d359233478318" name="data[sys_file_metadata][17169][description]" data-formengine-validation-rules="[]" data-formengine-input-name="data[sys_file_metadata][17169][description]" rows="3" wrap="virtual" data-formengine-field-change-event="change" data-formengine-field-change-items="[{"name":"typo3-backend-form-update-value","data":{"tableName":"sys_file_metadata","identifier":"17169","fieldName":"description","elementName":"data[sys_file_metadata][17169][description]"}}]" class="form-control t3js-formengine-textarea formengine-textarea" style="overflow: hidden; overflow-wrap: break-word; text-align: start; height: 72px;"></textarea>
No formengine validation exclamation fields are yielded for these two fields though. Also, because a native HTML5 'required' attribute is not set, that form can be saved then without errors.
It seems the problem is that:
data-formengine-validation-rules="[]"
is set instead of
data-formengine-validation-rules="[{"type":"required"}]"
This seems to happen because in:
$formData = $this->formDataCompiler->compile($formDataCompilerInput, GeneralUtility::makeInstance(TcaDatabaseRecord::class));
of typo3/sysext/backend/Classes/Controller/EditDocumentController.php
(L1131) the compiled $formData['processedTca']
is missing entries like required
, which can then not be evaluated.