Issue Bug Closed

#104894legacyHiddenField for Datetime Picker do not work

Christian Dorka 09/11/24, 08:45 updated 03/23/25, 21:51

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

Reviews 0

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

Files 1

History 2

  1. Benjamin Franzke commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2024-11-07T14:59:25+00:00" > 11/07/24, 14:59 </span>

    Please provide more context.
    We tried to add a compat layer in case date-time-picker was used in non-FormEngine context.

    It seems that you use a custom FormEngine via FormDataCompiler, but it seems that the DateTimeElement is initialized with custom markup.

    Can you provide a reproducable example?
    (minimal backend module that bootstrap FormDataCompiler with the mentioned TCA)

    Or alternatively try to update your custom code to match the current markup…

  2. Benni Mack commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2025-03-23T21:51:58+00:00" > 03/23/25, 21:51 </span>

    Closing this issue due to lack of feedback after 90 days. If you feel this is the wrong decisiom, let me know, so I will re-open the issue.