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

Commit 95c2066

Browse filesBrowse files
committed
feature #4096 labels in submit buttons + new screenshot (ricardclau)
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
2 parents 780a519 + 261f6b2 commit 95c2066
Copy full SHA for 95c2066

File tree

Expand file treeCollapse file tree

2 files changed

+7
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-5
lines changed

‎book/forms.rst

Copy file name to clipboardExpand all lines: book/forms.rst
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ from inside a controller::
103103
$form = $this->createFormBuilder($task)
104104
->add('task', 'text')
105105
->add('dueDate', 'date')
106-
->add('save', 'submit')
106+
->add('save', 'submit', array('label' => 'Create Post'))
107107
->getForm();
108108

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

133135
.. versionadded:: 2.3
134136
Support for submit buttons was introduced in Symfony 2.3. Before that, you had
@@ -217,7 +219,7 @@ controller::
217219
$form = $this->createFormBuilder($task)
218220
->add('task', 'text')
219221
->add('dueDate', 'date')
220-
->add('save', 'submit')
222+
->add('save', 'submit', array('label' => 'Create Post'))
221223
->getForm();
222224

223225
$form->handleRequest($request);
@@ -289,8 +291,8 @@ To do this, add a second button with the caption "Save and add" to your form::
289291
$form = $this->createFormBuilder($task)
290292
->add('task', 'text')
291293
->add('dueDate', 'date')
292-
->add('save', 'submit')
293-
->add('saveAndAdd', 'submit')
294+
->add('save', 'submit', array('label' => 'Create Post'))
295+
->add('saveAndAdd', 'submit', array('label' => 'Save and Add'))
294296
->getForm();
295297

296298
In your controller, use the button's

‎images/book/form-simple.png

Copy file name to clipboard
34 Bytes
Loading

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.