Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit244c26b

Browse files
committed
Merge pull requestsymfony#2821 from richardmiller/adding-buttons-to-forms
Add submit buttons to form building examples
2 parents7f14b3a +6f63b0c commit244c26b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎book/forms.rst‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ guess from the validation rules that both the ``task`` field is a normal
654654
$form = $this->createFormBuilder($task)
655655
->add('task')
656656
->add('dueDate', null, array('widget' => 'single_text'))
657+
->add('save', 'submit')
657658
->getForm();
658659
}
659660

@@ -918,6 +919,7 @@ ways. If you build your form in the controller, you can use ``setAction()`` and
918919
->setMethod('GET')
919920
->add('task', 'text')
920921
->add('dueDate', 'date')
922+
->add('save', 'submit')
921923
->getForm();
922924

923925
..note::
@@ -991,8 +993,9 @@ that will house the logic for building the task form::
991993
{
992994
public function buildForm(FormBuilderInterface $builder, array $options)
993995
{
994-
$builder->add('task');
995-
$builder->add('dueDate', null, array('widget' => 'single_text'));
996+
$builder->add('task')
997+
->add('dueDate', null, array('widget' => 'single_text'))
998+
->add('save', 'submit');
996999
}
9971000

9981001
public function getName()
@@ -1057,8 +1060,9 @@ the choice is ultimately up to you.
10571060

10581061
public function buildForm(FormBuilderInterface $builder, array $options)
10591062
{
1060-
$builder->add('task');
1061-
$builder->add('dueDate', null, array('mapped' => false));
1063+
$builder->add('task')
1064+
->add('dueDate', null, array('mapped' => false))
1065+
->add('save', 'submit');
10621066
}
10631067

10641068
Additionally, if there are any fields on the form that aren't included in
@@ -1731,6 +1735,7 @@ an array of the submitted data. This is actually really easy::
17311735
->add('name', 'text')
17321736
->add('email', 'email')
17331737
->add('message', 'textarea')
1738+
->add('send', 'submit')
17341739
->getForm();
17351740

17361741
$form->handleRequest($request);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp