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

[Form] Make difference between data and empty_data options more visisble #7802

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 4, 2017
Merged
Prev Previous commit
Next Next commit
Better explain empty_data values
  • Loading branch information
wouterj committed Apr 15, 2017
commit f37548947d5ec8a54d81e586e147616d225a65cf
9 changes: 8 additions & 1 deletion 9 form/use_empty_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ a ``data_class`` option for your form class, it will default to a new instance
of that class. That instance will be created by calling the constructor
with no arguments.

If you want to override this default behavior, there are two ways to do this.
If you want to override this default behavior, there are two ways to do this:

* `Option 1: Instantiate a new Class`_
* `Option 2: Provide a Closure`_

If you didn't set the ``data_class`` option, you can pass the initial data as
string or pass an array of strings (where the key matches the field name) when
the form type is compound.

Option 1: Instantiate a new Class
---------------------------------
Expand Down
6 changes: 3 additions & 3 deletions 6 reference/forms/types/options/empty_data.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ 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 with field names
as keys and submitted values as string values (or arrays if nested fields are
also compound).
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::

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.