Project

General

Profile

Actions

Bug #56668

closed

Epic #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

Added by Markus Kappe about 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
FormEngine aka TCEforms
Target version:
Start date:
2014-03-08
Due date:
% Done:

100%

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

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',

Actions #1

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.

Actions #2

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.

Actions #3

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)
Actions #4

Updated by Riccardo De Contardi almost 9 years ago

  • Status changed from New to Accepted
Actions #5

Updated by Frank Nägler over 8 years ago

  • Assignee set to Frank Nägler
  • Target version set to 7.6.1
Actions #6

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

Actions #7

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

Actions #8

Updated by Frank Nägler over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 50 to 100
Actions #9

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF