Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Form] String is the preferred value type for TextType#15404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
peter-gribanov wants to merge1 commit intosymfony:6.1
base:6.1
Choose a base branch
Loading
frompeter-gribanov:form_text_type_stringable_upgrade
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletionsreference/forms/types/color.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,11 +56,11 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_declaration.rst.inc

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data_description.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_description.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

Expand Down
4 changes: 2 additions & 2 deletionsreference/forms/types/email.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,11 +37,11 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_declaration.rst.inc

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data_description.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_description.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
``empty_data``
~~~~~~~~~~~~~~

**type**: ``mixed``
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
This option determines what value the field will *return* when the submitted
value is empty (or missing). It does not set an initial value if none is
provided when the form is rendered in a view.

This means it helps you handling form submission with blank fields. For
example, if you want the ``name`` field to be explicitly set to ``John Doe``
when no value is selected, you can do it like this::

$builder->add('name', null, [
'required' => false,
'empty_data' => 'John Doe',
]);

This will still render an empty text box, but upon submission the ``John Doe``
value will be set. Use the ``data`` or ``placeholder`` options to show this
initial value in the rendered form.

If a form is compound, you can set ``empty_data`` as an array, object or
closure. See the :doc:`/form/use_empty_data` article for more details about
these options.

.. note::

If you want to set the ``empty_data`` option for your entire form class,
see the :doc:`/form/use_empty_data` article.
4 changes: 2 additions & 2 deletionsreference/forms/types/password.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,11 +59,11 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_declaration.rst.inc

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data_description.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_description.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

Expand Down
4 changes: 2 additions & 2 deletionsreference/forms/types/range.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -52,11 +52,11 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_declaration.rst.inc

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data_description.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_description.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

Expand Down
4 changes: 2 additions & 2 deletionsreference/forms/types/search.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,11 +37,11 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_declaration.rst.inc

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data_description.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_description.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

Expand Down
4 changes: 2 additions & 2 deletionsreference/forms/types/tel.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,11 +43,11 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_declaration.rst.inc

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data_description.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_description.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

Expand Down
4 changes: 2 additions & 2 deletionsreference/forms/types/text.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,13 +27,13 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_declaration.rst.inc

From an HTTP perspective, submitted data is always a string or an array of strings.
So by default, the form will treat any empty string as null. If you prefer to get
an empty string, explicitly set the ``empty_data`` option to an empty string.

.. include:: /reference/forms/types/options/empty_data_description.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_description.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

Expand Down
4 changes: 2 additions & 2 deletionsreference/forms/types/textarea.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,11 +40,11 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_declaration.rst.inc

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data_description.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_description.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

Expand Down
4 changes: 2 additions & 2 deletionsreference/forms/types/url.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,11 +50,11 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_declaration.rst.inc

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data_description.rst.inc
.. include:: /reference/forms/types/options/text_empty_data_description.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp