Ivan Borysenko Ivan Borysenko - 1 month ago 22
Ajax Question

Sonata Admin Dependent Select ajax returns empty value

I have form with dependent selectBoxes.
I read tutorial http://symfony.com/doc/current/form/dynamic_form_modification.htmL

But in my representation ajax always return empty value
I use Sonata Admin

Answer

You controller Action must implement method:

 if ($request->isXmlHttpRequest()) {
        return $this->render('MyBundle:Task:ajax-template.html.twig', [
           'form' => $view,
        ]);
    }

And template:

{{ form_start(form) }}
{{ form_end(form) }}