Skip to content

labels in submit buttons + new screenshot #4096

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 1 commit into from
Aug 6, 2014
Merged
Show file tree
Hide file tree
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
12 changes: 7 additions & 5 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ from inside a controller::
$form = $this->createFormBuilder($task)
->add('task', 'text')
->add('dueDate', 'date')
->add('save', 'submit')
->add('save', 'submit', array('label' => 'Create Post'))
->getForm();

return $this->render('AcmeTaskBundle:Default:new.html.twig', array(
Expand All @@ -128,7 +128,9 @@ In this example, you've added two fields to your form - ``task`` and ``dueDate``
corresponding to the ``task`` and ``dueDate`` properties of the ``Task`` class.
You've also assigned each a "type" (e.g. ``text``, ``date``), which, among
other things, determines which HTML form tag(s) is rendered for that field.
Finally, you added a submit button for submitting the form to the server.

Finally, you added a submit button with a custom label for submitting the form to
the server.

.. versionadded:: 2.3
Support for submit buttons was introduced in Symfony 2.3. Before that, you had
Expand Down Expand Up @@ -217,7 +219,7 @@ controller::
$form = $this->createFormBuilder($task)
->add('task', 'text')
->add('dueDate', 'date')
->add('save', 'submit')
->add('save', 'submit', array('label' => 'Create Post'))
->getForm();

$form->handleRequest($request);
Expand Down Expand Up @@ -289,8 +291,8 @@ To do this, add a second button with the caption "Save and add" to your form::
$form = $this->createFormBuilder($task)
->add('task', 'text')
->add('dueDate', 'date')
->add('save', 'submit')
->add('saveAndAdd', 'submit')
->add('save', 'submit', array('label' => 'Create Post'))
->add('saveAndAdd', 'submit', array('label' => 'Save and Add'))
->getForm();

In your controller, use the button's
Expand Down
Binary file modified images/book/form-simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.