File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -66,14 +66,15 @@ class NDB_Form extends NDB_Page
66
66
* Attempts to validate the form (using the defined rules) and
67
67
* saves the validated data into the database
68
68
*
69
- * @return void
70
- * @access public
69
+ * @return bool
71
70
*/
72
- function save ()
71
+ public function save () : bool
73
72
{
74
- if ($ this ->form ->validate ()) {
75
- $ this ->form ->process ([&$ this , "_save " ]);
76
- }
73
+ if (!$ this ->form ->validate ()) {
74
+ return false ;
75
+ }
76
+ $ this ->form ->process ([&$ this , "_save " ]);
77
+ return true ;
77
78
}
78
79
79
80
/**
@@ -129,7 +130,9 @@ class NDB_Form extends NDB_Page
129
130
{
130
131
$ this ->setup ();
131
132
if ($ request ->getMethod () === "POST " ) {
132
- $ this ->save ();
133
+ if ($ this ->save ()) {
134
+ return new \LORIS \Http \Response \JSON \SeeOther ($ request ->getURI ());
135
+ }
133
136
}
134
137
135
138
return (new \LORIS \Http \Response ())
You can’t perform that action at this time.
0 commit comments