hello,
I'm trying to make my first form and I have some trouble with the csrf.
I've seen previous discussion on this subject but no one solve them.

here is my code :

//Entity with annotations
class TestEntity
{
    /**
     * @validation:MaxLength(160)
     * @validation:NotBlank
     */
    public $rawtext = '';
}

//the form class
class TestForm extends Form
{
    public function configure()
    {
        $this->setDataClass('Entity\\TestEntity');
        $this->add('rawtext');
    }
}

//controller
   public function indexAction()
    {
        $form = TestForm::create($this->get('form.context'), 'test');
        $form->bind($this->container->get('request'),new TestEntity);

        if($form->isValid()){
            var_dump($form->getData());
        }

        return array(
            'form' => $form,
        );
    }

//the view
<form action="#" method="post">
    {{ form_field(form) }}

    <input type="submit" value="Send!" />
</form>

I allways got the error : "The CSRF token is invalid. Please try to resubmit
the form"
But in the final form html element appear a hidden input witch name is
_token.

So I'm wondering where am I wrong ?
Thank you for reading

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to