开发者

CodeIgniter Custom Errors for Forms?

I am using <?php echo validation_errors(); ?> to display my CI errors and I am wondering if it is开发者_运维问答 possible to include custom errors (like if the username/password is incorrect?).

I tried $this->form_validation->set_message("Password or Username was incorrect");

However it didn't work. Any idea?

Thanks!


It's possible with CALLBACK.

http://codeigniter.com/user_guide/libraries/form_validation.html#callbacks


the right way is to display an error for what is wrong, if you want to test if the user exist make a callback to check if the user exist and set the message for that validation, if you want to check if the password is ok, make another callback with another message

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜