I’m using Kohana validation library and I want to set up my own user friendly error messages. The problem is that I generate the form dynamically, so field names are not know during development.
Can a set up error messages for the different validation rules (required, digit, …) regardless the field name? How?
Note: I’m using Kohana v2.3.4
I know about this problem.
What I ended up doing, is something like this (though this does not know what type of error occurred, it worked for me in my situation).
Assume
$errorsare the errors returned from the validation library.My view
Usually I would echo the
$errors['something']as the text node of thelabelelement, but because they are defined dynamically, I just printed a general purpose error.It’s not a great solution, but you may be able to get away with it.