views:

615

answers:

1

Hi,

I'm using Symfony 1.4.

I'm posting a form via Jquery ajax to an action which seems to work fine except that it's unable to bind the form and access the variables in the normal symfony way:

if ($request->isXmlHttpRequest()) 
{
    $this->form = new MessageForm();
    if($request->isMethod('post'))
    {
        $this->form->bind($request->getParameter('message'));
        if($this->form->isValid()) 
        {
            $values = $this->form->getValues();
            return $this->renderText($values['body']);
        }
    }
}

The array $values returns errors. However, I know the code passes through to the validation part, as I'm able to return other data from inside ->isValid(). The form only has two fields and both are set to required=false in the form class.

Can anyone tell me how to get the form to bind the values properly?

Thank you.

A: 

Solution: got it working eventually with the following:

http://www.symfony-project.org/plugins/sfJqueryReloadedPlugin

Tom