Hello, I want to use "Validation :: factory ()" to check my form.
I thus:
$ formData = \ input :: post ();
$ login = $ formData ;
$ val = Validation :: factory ();
$ val-> add ('login', $ login) -> add_rule ('required');
if ($ val-> run ())
{
blabla...
}
I have "ErrorException [ Error ]: Call to undefined method Fuel\Core\Validation::factory()"
Thx for your help !
Arsenik
That depends.
That will fetch the array of all validation error objects. You will have to iterate over it in the view, and apply the styling.
The other option is to pass the validation object to the view, and then use show_errors() to display them. Show errors uses a validation config file to define the HTML used to generate the result (by default it's an unordered list).
You can also fetch die individual field errors in the view (you need to pass the validation object for that), for example if you want to display the error next to the field that caused it.