Bug #27938

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

Added by Alexander Stehlik about 4 years ago. Updated almost 4 years ago.

Status:Resolved Start date:2011-07-07
Priority:Should have Due date:
Assigned To:- % Done:

100%

Category:ViewHelpers
Target version:-
Has patch:No Affected Flow version:

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.

sysext-fluid-27938-empty_textfield.diff Magnifier (513 Bytes) Alexander Stehlik, 2011-07-07 13:07

Associated revisions

Revision 05be2228
Added by Stefan Neufeind almost 4 years ago

[BUGFIX] Make textfield view helper handle zero (not empty) values

Values which are 0 (zero) are treated like but are not an empty string.
They need to be handled as normal values (output to be shown in field).

Thanks to Alexander Stehlik.

Change-Id: I9eabc845fe44e019e0c61e241cc9ebede152ba50
Resolves: #27938

History

#2 Updated by Mr. Hudson about 4 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 almost 4 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 almost 4 years ago

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

Also available in: Atom PDF