Issue Bug Rejected

#105513Formengine validation in Filelist / Missing processedTca 'config' entries

Garvin Hicking 10/29/24, 12:14 updated 10/29/24, 15:33

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="{&quot;field&quot;:&quot;data[sys_file_metadata][17169][title]&quot;}" 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="[{&quot;name&quot;:&quot;typo3-backend-form-update-value&quot;,&quot;data&quot;:{&quot;tableName&quot;:&quot;sys_file_metadata&quot;,&quot;identifier&quot;:&quot;17169&quot;,&quot;fieldName&quot;:&quot;description&quot;,&quot;elementName&quot;:&quot;data[sys_file_metadata][17169][description]&quot;}}]" 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="[{&quot;type&quot;:&quot;required&quot;}]"

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.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.