Can't set customer form error - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Can't set customer form error (/showthread.php?tid=70203) |
Can't set customer form error - randomhacks - 03-07-2018 Hello, I want to set a customer error message. Can anyone tell me why this doesn't it appear? Thanks, James PHP Code: $this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean'); RE: Can't set customer form error - Marcel - 03-08-2018 (03-07-2018, 01:52 PM)randomhacks Wrote: Hello, Just a quick look and im no expert but "$this->form_validation->set_message" I use when creating a custom validation rule? to see the error messages on the form after submit is thats what you looking for i do this in my controller / model $this->data[ 'submiterrorms' ] = validation_errors( '<p class="error_msg">', '</p>' ); and then have tis in my view <?php if (! empty($submiterrorms)) { ?> <?php echo $submiterrorms; ?> <?php } ?> or you can just use <?php echo validation_errors(); ?> RE: Can't set customer form error - jreklund - 03-08-2018 You need to validate the login with a callback. https://www.codeigniter.com/user_guide/libraries/form_validation.html#callbacks-your-own-validation-methods You can modify mine if you want. PHP Code: public function login() |