File tree 4 files changed +22
-6
lines changed
4 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -42,9 +42,9 @@ protected function initQuickNewRecord()
42
42
$ vp ->set (function ($ page ) {
43
43
$ form = \Atk4 \Ui \Form::addTo ($ page );
44
44
45
- $ model = clone $ this ->model ;
45
+ $ entity = $ this ->model -> createEntity () ;
46
46
47
- $ form ->setModel ($ model ->onlyFields ($ this ->plus ['fields ' ] ?? []));
47
+ $ form ->setModel ($ entity ->onlyFields ($ this ->plus ['fields ' ] ?? []));
48
48
49
49
$ form ->onSubmit (function (\Atk4 \Ui \Form $ form ) {
50
50
// Prevent from saving
Original file line number Diff line number Diff line change 39
39
]);
40
40
41
41
$ form ->onSubmit (function (Form $ form ) {
42
- $ str = $ form ->model ->ref ('country1 ' )->get ('name ' ) . ' ' . $ form ->model ->ref ('country2 ' )->get ('name ' ) . ' ' . (new Country ($ form ->getApp ()->db ))->tryLoad ($ form ->model ->get ('country3 ' ))->get ('name ' );
42
+ $ str = $ form ->model ->ref ('country1 ' )->get (Country::hinting ()->fieldName ()->name );
43
+ $ str .= '; ' ;
44
+ $ str .= $ form ->model ->ref ('country2 ' )->get (Country::hinting ()->fieldName ()->name );
45
+ $ str .= '; ' ;
46
+ $ str .= (new Country ($ form ->getApp ()->db ))->tryLoad ($ form ->model ->get ('country3 ' ))->get (Country::hinting ()->fieldName ()->name );
47
+
43
48
$ view = new \Atk4 \Ui \Message ('Select: ' ); // need in behat test.
44
49
$ view ->invokeInit ();
45
50
$ view ->text ->addParagraph ($ str );
Original file line number Diff line number Diff line change @@ -270,9 +270,9 @@ protected function initQuickNewRecord()
270
270
$ vp ->set (function ($ page ) {
271
271
$ form = \Atk4 \Ui \Form::addTo ($ page );
272
272
273
- $ model = clone $ this ->model ;
273
+ $ entity = $ this ->model -> createEntity () ;
274
274
275
- $ form ->setModel ($ model ->onlyFields ($ this ->plus ['fields ' ] ?? []));
275
+ $ form ->setModel ($ entity ->onlyFields ($ this ->plus ['fields ' ] ?? []));
276
276
277
277
$ form ->onSubmit (function (\Atk4 \Ui \Form $ form ) {
278
278
$ form ->model ->save ();
Original file line number Diff line number Diff line change @@ -14,4 +14,15 @@ Feature: Lookup
14
14
Then I press menu button "Add Category" using class "atk-grid-menu"
15
15
Then I select value "Beverages" in lookup "category"
16
16
Then I press Modal button "Save"
17
- Then Toast display should contains text 'Beverages'
17
+ Then Toast display should contains text "Beverages"
18
+
19
+ Scenario : Testing lookup add
20
+ Given I am on "form-control/lookup.php"
21
+ Then I press button "Add New"
22
+ When I fill in "atk_fp_country__name" with "New country"
23
+ When I fill in "atk_fp_country__iso" with "AA"
24
+ When I fill in "atk_fp_country__iso3" with "AAA"
25
+ When I fill in "atk_fp_country__numcode" with "88"
26
+ When I fill in "atk_fp_country__phonecode" with "8"
27
+ Then I press Modal button "Save"
28
+ Then Toast display should contains text "Form submit!"
You can’t perform that action at this time.
0 commit comments