Bug #28298
closedTCE form field with range cannot be cleared in some cases
100%
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
Updated by Gerrit Code Review almost 13 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
Updated by Gerrit Code Review almost 13 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7624
Updated by Gerrit Code Review almost 13 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
Updated by Gerrit Code Review almost 13 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
Updated by Anonymous almost 13 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset eba159fb2893ae51b0ea70eb3a0dd3d5b0e79143.