Project

General

Profile

Actions

Bug #104894

open

legacyHiddenField for Datetime Picker do not work

Added by Christian Dorka 3 months ago. Updated 18 days ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2024-09-11
Due date:
% Done:

0%

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

Description

After updating, to 12.4.19 we got problems that Forms with datepicker in Backend modules do not work.
I am using the FormDataCompiler for that which uses hidden fields.

I got following JS error:
"The hidden field for "@typo3/backend/date-time-picker.js" shall not be used. Please remove this field and supply the ISO8601 date in the user-facing field instead."

According to the typescript variable naming it´s the legacy hidden field "const legacyHiddenField" (File: Build/Sources/TypeScript/backend/date-time-picker.ts)

But its build via the new date configuration: https://docs.typo3.org/m/typo3/reference-tca/12.4/en-us/ColumnsConfig/Type/Datetime/Index.html#columns-datetime-migration

My code:

$GLOBALS['TCA']['tx_cpcsvexport_filter']['columns']['from'] = [
    'label' => 'Date from ',
    'config' => [
        'type' => 'datetime',
        'format' => 'date'
    ]
];

Problem is, that "onChange" the hidden input field do not get the value change of the datepicker, but an input field without the [name] attribute gets the value, via POST. So no value is submitted on sending (see screenshot in the files).

Following change fixes the error on my side:
=> const legacyHiddenField = inputElement.closest('typo3-formengine-element-datetime') ? null : inputElement.parentElement.parentElement.querySelector('input[type="hidden"]') as HTMLInputElement;
to
=> const legacyHiddenField = inputElement.closest('typo3-formengine-element-datetime') ? inputElement.parentElement.parentElement.querySelector('input[type="hidden"]') as HTMLInputElement : null;

Commit that causes this problem https://github.com/TYPO3/typo3/commit/2eedd4585d1c52170409c01e9bcf30484630a858


Files

Actions

Also available in: Atom PDF