File tree Expand file tree Collapse file tree 10 files changed +13
-13
lines changed
Filter options
Expand file tree Collapse file tree 10 files changed +13
-13
lines changed
Original file line number Diff line number Diff line change @@ -547,7 +547,7 @@ method:
547
547
548
548
$form->handleRequest($request);
549
549
550
- if ($form->isValid()) {
550
+ if ($form->isSubmitted() && $form-> isValid()) {
551
551
$data = $form->getData();
552
552
553
553
// ... perform some action, such as saving the data to the database
@@ -573,7 +573,7 @@ method:
573
573
574
574
$form->handleRequest($request);
575
575
576
- if ($form->isValid()) {
576
+ if ($form->isSubmitted() && $form-> isValid()) {
577
577
$data = $form->getData();
578
578
579
579
// ... perform some action, such as saving the data to the database
Original file line number Diff line number Diff line change @@ -391,7 +391,7 @@ For example, imagine you're processing a :doc:`form </forms>` submission::
391
391
{
392
392
// ...
393
393
394
- if ($form->isValid()) {
394
+ if ($form->isSubmitted() && $form-> isValid()) {
395
395
// do some sort of processing
396
396
397
397
$this->addFlash(
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ Now you're ready to use this service in the controller::
297
297
{
298
298
// ...
299
299
300
- if ($form->isValid()) {
300
+ if ($form->isSubmitted() && $form-> isValid()) {
301
301
$file = $product->getBrochure();
302
302
$fileName = $this->get('app.brochure_uploader')->upload($file);
303
303
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ submissions::
22
22
23
23
$form->handleRequest($request);
24
24
25
- if ($form->isValid()) {
25
+ if ($form->isSubmitted() && $form-> isValid()) {
26
26
// perform some action...
27
27
28
28
return $this->redirectToRoute('task_success');
@@ -63,7 +63,7 @@ method, pass the submitted data directly to
63
63
if ($request->isMethod('POST')) {
64
64
$form->submit($request->request->get($form->getName()));
65
65
66
- if ($form->isValid()) {
66
+ if ($form->isSubmitted() && $form-> isValid()) {
67
67
// perform some action...
68
68
69
69
return $this->redirectToRoute('task_success');
@@ -115,7 +115,7 @@ a convenient shortcut to the previous example::
115
115
if ($request->isMethod('POST')) {
116
116
$form->submit($request);
117
117
118
- if ($form->isValid()) {
118
+ if ($form->isSubmitted() && $form-> isValid()) {
119
119
// perform some action...
120
120
121
121
return $this->redirectToRoute('task_success');
Original file line number Diff line number Diff line change @@ -605,7 +605,7 @@ your application. Assume that you have a sport meetup creation controller::
605
605
$meetup = new SportMeetup();
606
606
$form = $this->createForm(new SportMeetupType(), $meetup);
607
607
$form->handleRequest($request);
608
- if ($form->isValid()) {
608
+ if ($form->isSubmitted() && $form-> isValid()) {
609
609
// ... save the meetup, redirect etc.
610
610
}
611
611
Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ In your controller, you'll now initialize a new instance of ``TaskType``::
178
178
179
179
$form->handleRequest($request);
180
180
181
- if ($form->isValid()) {
181
+ if ($form->isSubmitted() && $form-> isValid()) {
182
182
// ... maybe do some form processing, like saving the Task and Tag objects
183
183
}
184
184
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ In your controller, use the button's
22
22
:method: `Symfony\\ Component\\ Form\\ ClickableInterface::isClicked ` method for
23
23
querying if the "Save and add" button was clicked::
24
24
25
- if ($form->isValid()) {
25
+ if ($form->isSubmitted() && $form-> isValid()) {
26
26
// ... perform some action, such as saving the task to the database
27
27
28
28
$nextAction = $form->get('saveAndAdd')->isClicked()
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ an array of the submitted data. This is actually really easy::
27
27
28
28
$form->handleRequest($request);
29
29
30
- if ($form->isValid()) {
30
+ if ($form->isSubmitted() && $form-> isValid()) {
31
31
// data is an array with "name", "email", and "message" keys
32
32
$data = $form->getData();
33
33
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ be used to move the ``attachment`` file to a permanent location::
47
47
{
48
48
// ...
49
49
50
- if ($form->isValid()) {
50
+ if ($form->isSubmitted() && $form-> isValid()) {
51
51
$someNewFilename = ...
52
52
53
53
$form['attachment']->getData()->move($dir, $someNewFilename);
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ Creating an ACL and Adding an ACE
132
132
133
133
// ... setup $form, and submit data
134
134
135
- if ($form->isValid()) {
135
+ if ($form->isSubmitted() && $form-> isValid()) {
136
136
$entityManager = $this->getDoctrine()->getManager();
137
137
$entityManager->persist($comment);
138
138
$entityManager->flush();
You can’t perform that action at this time.
0 commit comments