File tree 3 files changed +23
-0
lines changed
3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Atk4 \Ui \Demos ;
6
+
7
+ use Atk4 \Ui \Form ;
8
+ use Atk4 \Ui \Js \JsToast ;
9
+
10
+ /** @var \Atk4\Ui\App $app */
11
+ require_once __DIR__ . '/../init-app.php ' ;
12
+
13
+ $ form = Form::addTo ($ app );
14
+
15
+ $ form ->onSubmit (static function (Form $ form ) {
16
+ return new JsToast ('Post ' . ($ form ->getApp ()->getRequest ()->getParsedBody () === [] ? 'ok ' : 'unexpected ' ));
17
+ });
Original file line number Diff line number Diff line change @@ -521,6 +521,7 @@ public function setupAjaxSubmit(): void
521
521
'on ' => 'submit ' ,
522
522
'url ' => $ this ->cb ->getJsUrl (),
523
523
'method ' => 'POST ' ,
524
+ 'contentType ' => 'application/x-www-form-urlencoded; charset=UTF-8 ' , // remove once https://github.com/jquery/jquery/issues/5346 is fixed
524
525
'serializeForm ' => true ,
525
526
], $ this ->apiConfig ));
526
527
Original file line number Diff line number Diff line change @@ -84,3 +84,8 @@ Feature: Form
84
84
When I click using selector "//label[text()='I am a developer']"
85
85
Then I should not see "Check all language that apply"
86
86
Then I should not see "Css"
87
+
88
+ Scenario : empty POST
89
+ Given I am on "_unit-test/form-empty.php"
90
+ When I press button "Save"
91
+ Then Toast display should contain text "Post ok"
You can’t perform that action at this time.
0 commit comments