Bug #56668

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 6 years ago. Updated over 2 years ago.

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

100%

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

Associated revisions

Revision 4ddb793f (diff)
Added by Frank Naegler over 4 years ago

[BUGFIX] TCA Time Field allow 0:00 as valid input

Resolves: #56668
Releases: master
Change-Id: I9ec1519ffbdde09b74165efc00074ceef3b38f84
Reviewed-on: https://review.typo3.org/45058
Reviewed-by: Oliver Hader <>
Tested-by: Oliver Hader <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>

History

#1 Updated by Markus Kappe about 6 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.

#2 Updated by Markus Kappe about 6 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.

#3 Updated by Felix Kopp over 5 years ago

  • Parent task set to #62836
  • TYPO3 Version changed from 6.1 to 7
  • PHP Version deleted (5.3)

#4 Updated by Riccardo De Contardi almost 5 years ago

  • Status changed from New to Accepted

#5 Updated by Frank Naegler over 4 years ago

  • Assignee set to Frank Naegler
  • Target version set to 7.6.1

#6 Updated by Gerrit Code Review over 4 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

#7 Updated by Gerrit Code Review over 4 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

#8 Updated by Frank Naegler over 4 years ago

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

#9 Updated by Riccardo De Contardi over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF