Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
validation->run() fails but I can't figure out why?
  • I am stuck with validation issue and I don't know how to proceed. Here is my controller code
      if (Input::method() == 'POST')
      {
       $val = Model_Article::validate('create');
          
       if ($val->run())
       {
        $article = Model_Article::create_article();
    
        if ($article)
        {
         Session::set_flash('success', '?lanek dodan #'.$user->id.'.');
         Response::redirect('admin/users');
        }
        else
        {
         Session::set_flash('error', 'Napaka pri dodajanju ?lanka.');
        }
       }
       else
       {
        $errors = $val->error();
       }
      }
    

    and my Model_Article code
     public static function validate($factory)
     {
      $val = Validation::forge($factory);
      $val->add_field('category_id', 'Kategorija', 'required');
      $val->add_field('title', 'Naslov ?lanka', 'required|max_length[500]');
      $val->add_field('summary', 'Povzetek ?lanka', 'required|max_length[500]');
      $val->add_field('body', 'Vsebina', 'required');
      $val->add_field('tags', 'Tagi', 'required');
      return $val;
     }
    

    The $val->run() will always return false... And the $val->error() is empty, so there are no input errors. What else could be wrong?
  • Never mind. Was problem in my jquery plugin I use for WYSIWYG editor! You can delete this thread.

Howdy, Stranger!

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

In this Discussion