Skip to content

Is .number modifier behavior for empty Strings really a bug as form-validation.md states? #2337

Open
@ErickPetru

Description

@ErickPetru

The form-validation.md file of the Cookbook states on line 289 that "there is a bug with this feature such that when the value is blank, it turns back into a string" refering to the fact that the .number modifier doesn't converts empty strings to number. Then again on line 329 it's refered as a bug. It's really annoying to see an oficial text refering to something as a bug!

Considering that a +'' returns 0, maybe the current modifier behavior is really misleading. But considering that the .number modifier documentation states that "if the value cannot be parsed with parseFloat(), then the original value is returned" and that parseFloat('') returns NaN, I believe that the current behavior of the modifier is the intended behavior, so the form-validation.md is incorrect.

So, should we correct the wrong affirmative in cookbook/form-validation.md? And there is any improvement on guide/forms.md to better clarify that the current behavior is the intended behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions