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
6666 * Attempts to validate the form (using the defined rules) and
6767 * saves the validated data into the database
6868 *
69- * @return void
70- * @access public
69+ * @return bool
7170 */
72- function save ()
71+ public function save () : bool
7372 {
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 ;
7778 }
7879
7980 /**
@@ -129,7 +130,9 @@ class NDB_Form extends NDB_Page
129130 {
130131 $ this ->setup ();
131132 if ($ request ->getMethod () === "POST " ) {
132- $ this ->save ();
133+ if ($ this ->save ()) {
134+ return new \LORIS \Http \Response \JSON \SeeOther ($ request ->getURI ());
135+ }
133136 }
134137
135138 return (new \LORIS \Http \Response ())
You can’t perform that action at this time.
0 commit comments