Bug #27938

Textfield view helper can not handle zero (not empty) values

Added by Alexander Stehlik over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
ViewHelpers
Target version:
-
Start date:
2011-07-07
Due date:
% Done:

100%

Estimated time:
Has patch:
No

Description

When using the form.textfield view helper strings or integers that are 0 (zero) are treated as empty values. So if a user now enters 0 in the form field and then edits the object the form field will not show the "0" he entered but an empty field.

This is because in TextfieldViewHelper the empty() function of PHP is used:

87 if (!empty($value)) {
88   $this->tag->addAttribute('value', $value);
89 }

Since AbstractFormFieldViewHelper::getValue() will return NULL if no value was set, it would be better to use isset() in my opinion.


Files

#2

Updated by Mr. Hudson over 10 years ago

Patch set 1 of change I9eabc845fe44e019e0c61e241cc9ebede152ba50 has been pushed to the review server.
It is available at http://review.typo3.org/3424

#3

Updated by Mr. Hudson over 10 years ago

Patch set 2 of change I9eabc845fe44e019e0c61e241cc9ebede152ba50 has been pushed to the review server.
It is available at http://review.typo3.org/3424

#4

Updated by Stefan Neufeind over 10 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF