codelgniter 4 from validation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: codelgniter 4 from validation (/showthread.php?tid=74777) |
codelgniter 4 from validation - seunex - 11-04-2019 Hello guys am stuck tying to learn this ci4 validations this is my view code PHP Code: <?= form_open('main/get_post') ?> here my controller PHP Code: public function get_post() i really do no know how to check errors i follow d docs i can get it onlike ci4 we use if($this->form_validation == false; here i am deeply confuse. RE: codelgniter 4 from validation - mightyted - 11-04-2019 (11-04-2019, 11:03 AM)seunex Wrote: Hello guys am stuck tying to learn this ci4 validations I dont see a password field in your form. That may be something to resolve. Also the getErrors() method returns key=> value pairs. Try echo $errors['username']; Also, normally you display error messages on the form itself , so..... if(!$validation->withRequest($this->request)->run()){ echo view('myformviewpage'); }else{ $model->save(...); } then in the formview try <?= \Config\Services::validation()->listErrors(); ?> |