Bug #28298

TCE form field with range cannot be cleared in some cases

Added by Jigal van Hemert about 11 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2011-07-18
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

After removing the TCA 'checkbox' option (the weird checkbox that cleared the field and could set the default value in it) and adding a clear icon inside the field to remove the contents, it is not possible to clear a (date) field which has a lower limit other than zero if the TCA definition of the field still has 'checkbox' => '0' (for backward compatibility).

The reason is a bit complex. The old 'checkbox' put the value of the checkbox property into the field. So, 'checkbox' => '0' would fill the field with '0' if the checkbox was unchecked.
The new clear icon just clears the input field and effectively fills it with an empty string value.

In t3lib_TCEmain::checkValue_input() there is a check:
if
'range' property is set
AND
new value != 'checkbox' value
AND
new value != 'default' value
then make sure value is inside range.
If both 'checkbox' => '0', 'default' => '0' are set you could -- in older versions -- clear the date field with the checkbox and this '0' value would prevent the range to take effect.
In the new situation the new value is '' if you clear the field. ('' != '0') gives TRUE for both the checkbox and the default property and thus activates the range check.

This effect can be seen in the tt_news records. Set the end-date field, save, clear the field, save, now the lower limit of the range property is inserted.

I don't see a quick solution with the loose comparison behaviour of PHP: http://www.php.net/manual/en/types.comparisons.php


Related issues

Has duplicate TYPO3 Core - Bug #26503: Endtime cannot be removedClosed2011-04-29

Actions
#1

Updated by Gerrit Code Review over 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7624

#2

Updated by Gerrit Code Review over 10 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7624

#3

Updated by Gerrit Code Review over 10 years ago

Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/8959

#4

Updated by Gerrit Code Review over 10 years ago

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/8960

#5

Updated by Philipp Kitzberger over 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#6

Updated by Benni Mack almost 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF