RudySkate
RudySkate

Reputation: 51

Symfony2 - Form processing with $_GET

It's a simply problem but, I have question about Form process (isValid() & GetData()) with $_GET request not a $_POST request.

$form->isValid() // return false everytime !
$form->getData() // return NULL everytime too

So I deduced that this was the method $_GET which prevents normal process of form validation. Someone has already had this problem ??

More infos : I've a class form name LargeSearchType.php without entity relation. Just a search engine form with many select,checkbox... My controller use Symfony2 standard (documentation) process form. (http://symfony.com/fr/doc/current/book/forms.html#gerer-la-soumission-des-formulaires)

Upvotes: 0

Views: 88

Answers (1)

JamesHalsall
JamesHalsall

Reputation: 13485

You should set the method of the form to GET:

$form = $this->createFormBuilder($task)
             ->setMethod('GET')

http://symfony.com/doc/current/book/forms.html#changing-the-action-and-method-of-a-form

Upvotes: 1

Related Questions