Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Validation doesn't work. $validator->run() always returns FALSE
  • Hello. I try to validate a serach-query, but $validator->run() always returns FALSE, even though the passed input-data was valid.

    #search-form (HTML)
    http://pastebin.com/n4s1Euf3

    #somewhere_in_search_controller
    http://pastebin.com/veh0RG9k

    I also tried the Form::open(), Form::close() methods... — same results :(
    #search-form (Form-Class)

    Do I miss/forgot something obvious ?!
  • HarroHarro
    Accepted Answer
    Your search form is a HTTP GET, not a POST.

    By default, run() processed posted data. There isn't any here, so it returns false. So either change your form to POST, or use

    if ($validation->run(\Input::get()))
    {
        ...
    }

    to explicity validate GET data.
  • Thx, Harro

Howdy, Stranger!

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

In this Discussion