Here is what I have:

class ProfileForm extends Form
{
    protected function configure()
    {
        $this->add(new TextField('name', array(
            'required' => false,
        )));
        $this->add(new TextField('location', array(
            'required' => false,
        )));
        $this->add(new TextareaField('about', array(
            'required' => false,
        )));
        $this->add(new BirthdayField('birthday', array(
            'required' => false,
        )));
        $this->add(new ChoiceField('gender', array(
            'choices' => array(
                'm'      => 'Male',
                'f'      => 'Female',
                'secret' => 'Rather not say',
            ),
            'expanded' => true,
        )));
    }
}

class Profile
{
    public $name;
    public $location;
    public $about;

    /**
     * @assert:Choice(choices={"m", "f", "secret"})
     */
    public $gender;

    /**
     * @assert:Date
     */
    public $birthday;

    public function setBirthday($birthday)
    {
        $this->birthday = $birthday instanceof \DateTime ? $birthday-
>format('Y-m-d') : $birthday;
    }
}

$profile = new Profile();
$form = ProfileForm::create($this->get('form.context'), 'profile');
$form->bind($this->get('request'), $profile);

if ($form->isValid()) {
    // do something
}

for some reason when I submit it return an error for field
"profile[birthday]" with "The CSRF token is invalid. Please try to
resubmit the form".

What do you think happened?

-- 
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 developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to