Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TextType empty_data = null if string is empty #7596

@markoffk

Description

@markoffk
Q A
Bug report? yes
Symfony version 3.2.4

Hello.

I am getting null value after passing empty string to symfony form field.
After defining empty_data in form builder, the problem has gone:

        $builder
            ->add('name', TextType::class, [
                'empty_data'  => '',
            ])

But documentation claims that empty_data is empty string ('') by default. So either the documentation should be changed or behavior of form field type.

Link to docs: http://symfony.com/doc/current/reference/forms/types/text.html#empty-data

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FormhasPRA Pull Request has already been submitted for this issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions