File tree Expand file tree Collapse file tree 3 files changed +41
-7
lines changed Expand file tree Collapse file tree 3 files changed +41
-7
lines changed Original file line number Diff line number Diff line change 27
27
},
28
28
"require-dev" : {
29
29
"nette/tester" : " ~1.3" ,
30
+ "nette/forms" : " ~2.2" ,
30
31
"latte/latte" : " ~2.2.2"
31
32
},
32
33
"conflict" : {
Original file line number Diff line number Diff line change @@ -68,20 +68,20 @@ protected function attached($presenter)
68
68
$ this ->getElementPrototype ()->id = 'frm- ' . $ name ;
69
69
}
70
70
71
- if (!$ this ->getAction ()) {
72
- $ this ->setAction (new Link ($ presenter , 'this ' , array ()));
73
- $ signal = new Nette \Forms \Controls \HiddenField ($ name . self ::NAME_SEPARATOR . 'submit ' );
74
- $ signal ->setOmitted ()->setHtmlId (FALSE );
75
- $ this [Presenter::SIGNAL_KEY ] = $ signal ;
76
- }
77
-
78
71
if (iterator_count ($ this ->getControls ()) && $ this ->isSubmitted ()) {
79
72
foreach ($ this ->getControls () as $ control ) {
80
73
if (!$ control ->isDisabled ()) {
81
74
$ control ->loadHttpData ();
82
75
}
83
76
}
84
77
}
78
+
79
+ if (!$ this ->getAction ()) {
80
+ $ this ->setAction (new Link ($ presenter , 'this ' , array ()));
81
+ $ signal = new Nette \Forms \Controls \HiddenField ($ name . self ::NAME_SEPARATOR . 'submit ' );
82
+ $ signal ->setOmitted ()->setHtmlId (FALSE );
83
+ $ this [Presenter::SIGNAL_KEY ] = $ signal ;
84
+ }
85
85
}
86
86
parent ::attached ($ presenter );
87
87
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * Test: Nette\Application\UI\Form
5
+ */
6
+
7
+ use Nette \Application \UI ,
8
+ Tester \Assert ;
9
+
10
+
11
+ require __DIR__ . '/../bootstrap.php ' ;
12
+
13
+
14
+ class TestPresenter extends UI \Presenter
15
+ {
16
+
17
+ }
18
+
19
+
20
+ test (function () {
21
+ $ presenter = new TestPresenter ;
22
+ $ form = new UI \Form ($ presenter , 'name ' );
23
+ $ form ->setMethod ($ form ::GET ); // must not throw exception
24
+ });
25
+
26
+
27
+ test (function () { // compatibility with 2.0
28
+ $ presenter = new TestPresenter ;
29
+ $ form = new UI \Form ;
30
+ $ form ->setAction ('action ' );
31
+ $ presenter ['name ' ] = $ form ;
32
+ Assert::false (isset ($ form [TestPresenter::SIGNAL_KEY ]));
33
+ });
You can’t perform that action at this time.
0 commit comments