Bug #56668
closedEpic #62041: twbs Bootstrap backend, refactor EXT:t3skin and HTML5 output
Epic #62836: FormEngine PHP/HTML Improvements & Bootstrap
TCA Time Field - 0:00 equals no input
100%
Description
Hi,
I've got a time field
// TCA 'config' => array( 'type' => 'input', 'size' => '30', 'eval' => 'time', )
and cannot enter 0:00 into it. Whenever I try it, the displayed value disappears (field gets empty). So the backend form cannot distinguish between zero and null. That is even worse, when I need
'eval' => 'time,required',
Updated by Markus Kappe about 10 years ago
- % Done changed from 0 to 80
Two steps to solve this:
1) TCA
'config' => array( 'type' => 'input', 'size' => '8', 'eval' => 'time', 'checkbox' => '', )
Add the checkbox config parameter. That way zero does not mean null to the javascript. Instead an empty string means null. If the checkbox parameter is omitted, zero is the default for the value that equals null.
2) JavaScript t3lib/jsfunc.evalfield.js ~line 458
case "time": case "timesec": // if (!parseInt(value)) {return '';} // WRONG if (!parseInt(value) && value !== '0') {return '';} // RIGHT var theTime = new Date(parseInt(value) * 1000);
That way the display doesn't get empty when a zero value (meaning 0:00) is entered.
There should be an explanation for the checkbox parameter in the documentation, preferably at TCA: type "input", eval "time".
Requesting to include the bugfix in the next version of the core.
Updated by Markus Kappe about 10 years ago
- % Done changed from 80 to 50
In order to make 0:00 work with eval => "time,required", you have to modify typo3/jsfunc.tbe_editor.js too.
~line 209
if (!value || elementData.additional && elementData.additional.isPositiveNumber && (isNaN(value) || Number(value) < 0)) {
Change "less that or equal zero" to "less than zero".
After that change, the text "isPositiveNumber" does not reflect its behaviour anymore. So that keyword should be renamed as well.
And I am afraid after the changes it is not possible anymore to have null values - maybe there should be done something about that, too.
Updated by Felix Kopp over 9 years ago
- Parent task set to #62836
- TYPO3 Version changed from 6.1 to 7
- PHP Version deleted (
5.3)
Updated by Riccardo De Contardi almost 9 years ago
- Status changed from New to Accepted
Updated by Frank Nägler over 8 years ago
- Assignee set to Frank Nägler
- Target version set to 7.6.1
Updated by Gerrit Code Review over 8 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/45058
Updated by Gerrit Code Review over 8 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/45058
Updated by Frank Nägler over 8 years ago
- Status changed from Under Review to Resolved
- % Done changed from 50 to 100
Applied in changeset 4ddb793fa3f20ac93829783702046631a50bfefc.
Updated by Riccardo De Contardi over 6 years ago
- Status changed from Resolved to Closed