@@ -505,10 +505,27 @@ public function submit($submittedData, bool $clearMissing = true)
505505 // they are collectable during submission only
506506 $ this ->errors = [];
507507
508+ $ dispatcher = $ this ->config ->getEventDispatcher ();
509+
508510 // Obviously, a disabled form should not change its data upon submission.
509- if ($ this ->isDisabled ()) {
511+ if ($ this ->isDisabled () && $ this -> isRoot () ) {
510512 $ this ->submitted = true ;
511513
514+ if ($ dispatcher ->hasListeners (FormEvents::PRE_SUBMIT )) {
515+ $ event = new FormEvent ($ this , $ submittedData );
516+ $ dispatcher ->dispatch (FormEvents::PRE_SUBMIT , $ event );
517+ }
518+
519+ if ($ dispatcher ->hasListeners (FormEvents::SUBMIT )) {
520+ $ event = new FormEvent ($ this , $ this ->getNormData ());
521+ $ dispatcher ->dispatch (FormEvents::SUBMIT , $ event );
522+ }
523+
524+ if ($ dispatcher ->hasListeners (FormEvents::POST_SUBMIT )) {
525+ $ event = new FormEvent ($ this , $ this ->getViewData ());
526+ $ dispatcher ->dispatch (FormEvents::POST_SUBMIT , $ event );
527+ }
528+
512529 return $ this ;
513530 }
514531
@@ -538,8 +555,6 @@ public function submit($submittedData, bool $clearMissing = true)
538555 $ this ->transformationFailure = new TransformationFailedException ('Submitted data was expected to be text or number, array given. ' );
539556 }
540557
541- $ dispatcher = $ this ->config ->getEventDispatcher ();
542-
543558 $ modelData = null ;
544559 $ normData = null ;
545560 $ viewData = null ;
@@ -752,10 +767,6 @@ public function isValid()
752767 throw new LogicException ('Cannot check if an unsubmitted form is valid. Call Form::isSubmitted() before Form::isValid(). ' );
753768 }
754769
755- if ($ this ->isDisabled ()) {
756- return true ;
757- }
758-
759770 return 0 === \count ($ this ->getErrors (true ));
760771 }
761772
0 commit comments