File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
src/Symfony/Component/Form Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,12 @@ public function isClicked()
43
43
*/
44
44
public function submit ($ submittedData , $ clearMissing = true )
45
45
{
46
+ if ($ this ->getConfig ()->getDisabled ()) {
47
+ $ this ->clicked = false ;
48
+
49
+ return $ this ;
50
+ }
51
+
46
52
parent ::submit ($ submittedData , $ clearMissing );
47
53
48
54
$ this ->clicked = null !== $ submittedData ;
Original file line number Diff line number Diff line change @@ -1066,6 +1066,28 @@ public function testClickedButtonFromParentForm()
1066
1066
$ this ->assertSame ($ button , $ this ->form ->getClickedButton ());
1067
1067
}
1068
1068
1069
+ public function testDisabledButtonIsNotSubmitted ()
1070
+ {
1071
+ $ button = new SubmitButtonBuilder ('submit ' );
1072
+ $ submit = $ button
1073
+ ->setDisabled (true )
1074
+ ->getForm ();
1075
+
1076
+ $ form = $ this ->createForm ()
1077
+ ->add ($ this ->getBuilder ('text ' )->getForm ())
1078
+ ->add ($ submit )
1079
+ ;
1080
+
1081
+ $ form ->submit (array (
1082
+ 'text ' => '' ,
1083
+ 'submit ' => '' ,
1084
+ ));
1085
+
1086
+ $ this ->assertTrue ($ submit ->isDisabled ());
1087
+ $ this ->assertFalse ($ submit ->isClicked ());
1088
+ $ this ->assertFalse ($ submit ->isSubmitted ());
1089
+ }
1090
+
1069
1091
protected function createForm ()
1070
1092
{
1071
1093
return $ this ->getBuilder ()
You can’t perform that action at this time.
0 commit comments