@@ -58,12 +58,11 @@ public function getPresenter($need = TRUE)
5858 protected function attached ($ presenter )
5959 {
6060 if ($ presenter instanceof Presenter) {
61- $ name = $ this ->lookupPath (Presenter::class);
6261 if (!isset ($ this ->getElementPrototype ()->id )) {
63- $ this ->getElementPrototype ()->id = 'frm- ' . $ name ;
62+ $ this ->getElementPrototype ()->id = 'frm- ' . $ this -> lookupPath (Presenter::class) ;
6463 }
6564 if (!$ this ->getAction ()) {
66- $ this ->setAction (new Link ($ presenter , $ name . self :: NAME_SEPARATOR . ' submit ' ));
65+ $ this ->setAction (new Link ($ presenter , ' this ' ));
6766 }
6867
6968 $ controls = $ this ->getControls ();
@@ -96,33 +95,34 @@ public function isAnchored()
9695 protected function receiveHttpData ()
9796 {
9897 $ presenter = $ this ->getPresenter ();
99- $ isPost = $ this ->getMethod () === self ::POST ;
100-
101- $ action = $ this ->getAction ();
102- if ($ action instanceof Link) {
103- $ this [($ isPost ? '_ ' : '' ) . Presenter::SIGNAL_KEY ] =
104- (new Nette \Forms \Controls \HiddenField ($ action ->getDestination ()))
105- ->setOmitted ()->setHtmlId (FALSE );
106- $ this ->setAction (new Link ($ presenter , 'this ' ));
107- }
108-
10998 if (!$ presenter ->isSignalReceiver ($ this , 'submit ' )) {
11099 return ;
111100 }
112101
113102 $ request = $ presenter ->getRequest ();
114- if ($ request ->isMethod ('forward ' ) || $ request ->isMethod ('post ' ) !== $ isPost ) {
103+ if ($ request ->isMethod ('forward ' ) || $ request ->isMethod ('post ' ) !== $ this -> isMethod ( ' post ' ) ) {
115104 return ;
116105 }
117106
118- if ($ isPost ) {
107+ if ($ this -> isMethod ( ' post ' ) ) {
119108 return Nette \Utils \Arrays::mergeTree ($ request ->getPost (), $ request ->getFiles ());
120109 } else {
121110 return $ request ->getParameters ();
122111 }
123112 }
124113
125114
115+ public function beforeRender ()
116+ {
117+ parent ::beforeRender ();
118+ $ key = ($ this ->isMethod ('post ' ) ? '_ ' : '' ) . Presenter::SIGNAL_KEY ;
119+ if (!isset ($ this [$ key ])) {
120+ $ do = $ this ->lookupPath (Presenter::class) . self ::NAME_SEPARATOR . 'submit ' ;
121+ $ this [$ key ] = (new Nette \Forms \Controls \HiddenField ($ do ))->setOmitted ()->setHtmlId (FALSE );
122+ }
123+ }
124+
125+
126126 /********************* interface ISignalReceiver ****************d*g**/
127127
128128
0 commit comments