diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index 8e3c702b..3659369b 100755 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -178,13 +178,10 @@ class UserController extends AdminController ] ], ]; - if (!$this->validate($rules)) { - return $this->response->setStatusCode(400)->setJSON([ - 'status' => false, - 'message' => 'Input validation failed', - 'code' => 400, - 'errors' => $this->validator->getErrors() - ]); + if (!$this->validate($rules)) { + return redirect()->to(base_url('/user/list')) + ->withInput() + ->with('errors', $this->validator->getErrors()); } $userData['created_by'] = get_session_userid(); @@ -363,12 +360,9 @@ class UserController extends AdminController ], ]; if (!$this->validate($rules)) { - return $this->response->setStatusCode(400)->setJSON([ - 'status' => false, - 'message' => 'Input validation failed', - 'code' => 400, - 'errors' => $this->validator->getErrors() - ]); + return redirect()->to(base_url('/user/list')) + ->withInput() + ->with('errors', $this->validator->getErrors()); } $data = $this->request->getPost(); @@ -845,7 +839,7 @@ class UserController extends AdminController ], 'errors' => [ 'required' => 'Retention Rate is required', - 'regex_match' => 'Retention Rate must be between 0 and 100 with up to 2 decimal places' + 'regex_match' => 'Retention Rate must be between 0 to 100 with up to 2 decimal places' ] ], // ====================== diff --git a/app/Views/UserList.php b/app/Views/UserList.php index 571ddda9..919e7de1 100755 --- a/app/Views/UserList.php +++ b/app/Views/UserList.php @@ -884,12 +884,18 @@ table.dataTable tbody td { + +getFlashdata('errors')): ?> + + + getFlashdata('error')) : ?> - getFlashdata('error') as $error) : ?> - -