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

Appearance settings

Commit ee81654

Browse filesBrowse files
committed
minor #10743 [Forms] Fixed TextType empty_data value explanation (vudaltsov)
This PR was merged into the 3.4 branch. Discussion ---------- [Forms] Fixed TextType empty_data value explanation #SymfonyConHackDay See symfony/symfony#18357 that introduced a way to use an empty string in models, so setter does not have to be nullable. Usage example: https://github.com/EnMarche/en-marche.fr/blob/master/src/Form/TypeExtension/TextTypeExtension.php#L28 Thanx to @HeahDude for helping me with this PR. Commits ------- 5cfff92 Fix TextType empty_data value explanation
2 parents dd2788c + 5cfff92 commit ee81654
Copy full SHA for ee81654

File tree

1 file changed

+3
-1
lines changed
Filter options

1 file changed

+3
-1
lines changed

‎reference/forms/types/text.rst

Copy file name to clipboardExpand all lines: reference/forms/types/text.rst
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
4444
.. include:: /reference/forms/types/options/empty_data.rst.inc
4545
:end-before: DEFAULT_PLACEHOLDER
4646

47-
The default value is ``''`` (the empty string).
47+
From an HTTP perspective, submitted data is always a string or an array of strings.
48+
So by default, the form will treat any empty string as null. If you prefer to get
49+
an empty string, explicitly set the ``empty_data`` option to an empty string.
4850

4951
.. include:: /reference/forms/types/options/empty_data.rst.inc
5052
:start-after: DEFAULT_PLACEHOLDER

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.