Welcome Guest, Not a member yet? Register   Sign In
Custom Error Messages for each Validated Form Element
#1

[eluser]Eric Cope[/eluser]
I know there is a way of setting custom error messages for validation rules (i.e. required, trim, etc.) However, is there a way of creating custom error messages for form elements? I know I can create custom callback functions, one for each form element, and then emed all the rules in it, but that does not seem as elegant as CI typically is. Any ideas are welcome.
#2

[eluser]ekeretex[/eluser]
You can edit (or add to) the validation language file (system/language/{language}/validation_lang.php).

Alternatively you could overide the error message in the controller. This works:
Code:
$this->validation->_error_messages['required'] = "You forgot to type the %s";




Theme © iAndrew 2016 - Forum software by © MyBB