0

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.

1 Answer 1

1

Solution: got it working eventually with the following:

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.