8000 [book] [forms] misc. fixes and tweaks by javiereguiluz · Pull Request #3739 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[book] [forms] mi 8000 sc. fixes and tweaks #3739

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 2 commits into from
Apr 2, 2014
Merged
Changes from all 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
24 changes: 13 additions & 11 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ learning the most important features of the form library along the way.

The Symfony Form component is a standalone library that can be used outside
of Symfony2 projects. For more information, see the `Symfony2 Form component`_
on Github.
on GitHub.

.. index::
single: Forms; Create a simple form
Expand All @@ -39,6 +39,7 @@ going to need to build a form. But before you begin, first focus on the generic
{
return $this->task;
}

public function setTask($task)
{
$this->task = $task;
Expand All @@ -48,7 +49,7 @@ going to need to build a form. But before you begin, first focus on the generic
{
return $this->dueDate;
}

public function setDueDate(\DateTime $dueDate = null)
{
$this->dueDate = $dueDate;
Expand Down Expand Up @@ -172,7 +173,7 @@ helper functions:

That's it! By printing ``form(form)``, each field in the form is rendered, along
with a label and error message (if there is one). The ``form`` function also
surrounds everything in the necessary HTML ``form`` tag. As easy as this is,
surrounds everything in the necessary HTML ``<form>`` tag. As easy as this is,
it's not very flexible (yet). Usually, you'll want to render each form field
individually so you can control how the form looks. You'll learn how to do
that in the ":ref:`form-rendering-template`" section.
Expand Down Expand Up @@ -267,7 +268,8 @@ possible paths:
.. note::

Redirecting a user after a successful form submission prevents the user
from being able to hit "refresh" and re-post the data.
from being able to hit the "Refresh" button of their browser and re-post
the data.

.. index::
single: Forms; Multiple Submit Buttons
Expand Down Expand Up @@ -566,7 +568,7 @@ First, we need to add the two buttons to the form::

Then, we configure the button for returning to the previous step to run
specific validation groups. In this example, we want it to suppress validation,
so we set its ``validation_groups`` options to false::
so we set its ``validation_groups`` option to false::

$form = $this->createFormBuilder($task)
// ...
Expand Down Expand Up @@ -979,10 +981,10 @@ to the ``form()`` or the ``form_start()`` helper:
.. note::

If the form's method is not GET or POST, but PUT, PATCH or DELETE, Symfony2
will insert a hidden field with the name "_method" that stores this method.
will insert a hidden field with the name ``_method`` that stores this method.
The form will be submitted in a normal POST request, but Symfony2's router
is capable of detecting the "_method" parameter and will interpret the
request as PUT, PATCH or DELETE request. Read the cookbook chapter
is capable of detecting the ``_method`` parameter and will interpret it as
a PUT, PATCH or DELETE request. Read the cookbook chapter
":doc:`/cookbook/routing/method_parameters`" for more information.

.. index::
Expand Down Expand Up @@ -1076,7 +1078,8 @@ the choice is ultimately up to you.

public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('task')
$builder
->add('task')
->add('dueDate', null, array('mapped' => false))
->add('save', 'submit');
}
Expand Down Expand Up @@ -1316,8 +1319,7 @@ the ``cascade_validation`` option to ``TaskType``::
));
}

Render the ``Category`` fields in the same way
as the original ``Task`` fields:
Render the ``Category`` fields in the same way as the original ``Task`` fields:

.. configuration-block::

Expand Down
0