Welcome Guest, Not a member yet? Register   Sign In
Form validation error messages on a rule and field basis
#1

[eluser]sqwk[/eluser]
At the moment one can only set error messages on a rule basis:

Code:
$this->form_validation->set_message('required', 'You should really fill this out');

However, sometimes it i necessary to only show a custom message for a particular field. Is it possible to further limit custom messages by the fieldname?

Something like this:

Code:
$this->form_validation->set_message('rule', 'Message','field');


#2

[eluser]Unknown[/eluser]
Although this is an older post, for anyone still searching, I've created a gist which will extend the Form Validation library to add this functionality here:

https://gist.github.com/2364955

I've also submitted a pull request to have this added to the CodeIgniter source, here:

https://github.com/EllisLab/CodeIgniter/pull/1252

Hope that helps!

Sorry for un-clickable links, couldn't get the forum submission to cooperate!




Theme © iAndrew 2016 - Forum software by © MyBB