Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Error with
  • 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
  • The factory() methods were deprecated in v1.1, and removed in v1.2. See the changelog: https://github.com/fuel/core/wiki/Changelog-v1.2
  • "Aw, crap!" the other looks like xD
    thanks a lot! To view the errors, it is always this ?
    $ this-> template-> content ('error', $ val-> error ());
  • 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.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion