Skip to content

Commit

Permalink
feature #4096 labels in submit buttons + new screenshot (ricardclau)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.3 branch.

Discussion
----------

labels in submit buttons + new screenshot

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

As per @weaverryan suggestion in #3983 discussion

PR is made against 2.3 branch since this is when submit buttons were added

Commits
-------

261f6b2 labels in submit buttons + new screenshot
  • Loading branch information
weaverryan committed Aug 6, 2014
2 parents 780a519 + 261f6b2 commit 95c2066
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
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.

0 comments on commit 95c2066

Please sign in to comment.