Project

General

Profile

Actions

Bug #62739

closed

ReadOnly DateTime fields are broken in Backend Forms

Added by Robert Vock about 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2014-11-06
Due date:
% Done:

0%

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

Description

When a table has a configuration for a column to be readOnly and eval as datetime, the backend form generated a PHP Warning and shows no form:

$columns['activated_on'] = array(
    'exclude' => 1,
    'label' => 'LLL:EXT:sf_register/Resources/Private/Language/locallang_be.xml:fe_users.activated_on',
    'config' => array(
        'type' => 'input',
        'readOnly' => TRUE,
        'eval' => 'datetime',
    )
);

#1: PHP Warning: date() expects parameter 2 to be long, string given in typo3/sysext/backend/Classes/Form/FormEngine.php line 3583

This happens because the FormEngine class tries to render the field and the value for a new field is the empty string:
TYPO3\CMS\Backend\Form\FormEngine:1503

This could be solved, if the itemFormElValue is cast to an integer, if a datetime format is detected.

You could also argue, that this is a misconfiguration in TCA, because adding 'default' => 0 also solves the problem:

$columns['activated_on'] = array(
    'exclude' => 1,
    'label' => 'LLL:EXT:sf_register/Resources/Private/Language/locallang_be.xml:fe_users.activated_on',
    'config' => array(
        'type' => 'input',
        'readOnly' => TRUE,
        'eval' => 'datetime',
        'default' => 0,
    )
);

Actions

Also available in: Atom PDF