Project

General

Profile

Actions

Bug #105513

closed

Formengine validation in Filelist / Missing processedTca 'config' entries

Added by Garvin Hicking 24 days ago. Updated 24 days ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2024-10-29
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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.

Actions #1

Updated by Garvin Hicking 24 days ago

  • Status changed from Accepted to Rejected
  • Is Regression changed from Yes to No

Never mind, I saw the error of my ways.

I edited the TCA sys_file_reference.php file. Howevever, the TCA in sys_file_metadata.php takes precedence, overriding the 'config' of a file record.

Once I set 'required=true' in the TCA of that file, it all works again.

Actions

Also available in: Atom PDF