@@ -103,7 +103,7 @@ from inside a controller::
103
103
$form = $this->createFormBuilder($task)
104
104
->add('task', 'text')
105
105
->add('dueDate', 'date')
106
- ->add('save', 'submit')
106
+ ->add('save', 'submit', array('label' => 'Create Post') )
107
107
->getForm();
108
108
109
109
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``
128
128
corresponding to the ``task `` and ``dueDate `` properties of the ``Task `` class.
129
129
You've also assigned each a "type" (e.g. ``text ``, ``date ``), which, among
130
130
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.
132
134
133
135
.. versionadded :: 2.3
134
136
Support for submit buttons was introduced in Symfony 2.3. Before that, you had
@@ -217,7 +219,7 @@ controller::
217
219
$form = $this->createFormBuilder($task)
218
220
->add('task', 'text')
219
221
->add('dueDate', 'date')
220
- ->add('save', 'submit')
222
+ ->add('save', 'submit', array('label' => 'Create Post') )
221
223
->getForm();
222
224
223
225
$form->handleRequest($request);
@@ -289,8 +291,8 @@ To do this, add a second button with the caption "Save and add" to your form::
289
291
$form = $this->createFormBuilder($task)
290
292
->add('task', 'text')
291
293
->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') )
294
296
->getForm();
295
297
296
298
In your controller, use the button's
0 commit comments