Permalink
Browse files

minor #3739 [book] [forms] misc. fixes and tweaks (javiereguiluz)

This PR was merged into the 2.3 branch.

Discussion
----------

[book] [forms] misc. fixes and tweaks

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3+
| Fixed tickets | -

Commits
-------

1583f3b [book] [forms] minor fixes and rewordings
d4336b7 [book] [forms] misc. fixes and tweaks
  • Loading branch information...
weaverryan committed Apr 2, 2014
2 parents ce582ec + 1583f3b commit f149dcf85efb5eb029a499413a80543be094a1df
Showing with 13 additions and 11 deletions.
  1. +13 −11 book/forms.rst
View
@@ -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
@@ -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;
@@ -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;
@@ -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.
@@ -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
@@ -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)
// ...
@@ -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::
@@ -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');
}
@@ -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::

0 comments on commit f149dcf

Please sign in to comment.