Bug #62739
closedReadOnly DateTime fields are broken in Backend Forms
0%
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, ) );
Updated by Wouter Wolters about 10 years ago
- Status changed from New to Resolved
Hi Robert, this problem has been fixed last week in the 6.2 branch.
https://review.typo3.org/#/c/33661/2/typo3/sysext/backend/Classes/Form/FormEngine.php
With the next release of TYPO3 CMS 6.2 this is solved.
Updated by Robert Vock about 10 years ago
Thanks and sorry for duplicate. I only searched open bugs :)