Project

General

Profile

Actions

Bug #28298

closed

TCE form field with range cannot be cleared in some cases

Added by Jigal van Hemert over 13 years ago. Updated about 6 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 1 (0 open1 closed)

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

Actions
Actions

Also available in: Atom PDF