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

Also available in: Atom PDF