LinioIT / dynamic-form-bundle

Generates symfony forms based on Yaml configuration files
18 stars 11 forks source link

isSubmitted and isValid not working #10

Closed HellPat closed 8 years ago

HellPat commented 8 years ago

My form renders correctly and is a very simple configuration. If i submit is neighter isSubmitted() nor isValid() do work.

dynamic_form:
    new_user:
        title:
            enabled: true
            type: text
        password:
            enabled: true
            type: password
        meta_keywords:
            enabled: true
            type: textarea
        meta_description:
            enabled: true
            type: textarea
        published:
            enabled: true
            type: checkbox
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {
        // Create the dynamic form
        /** @var \Symfony\Component\Form\Form $form */
        $form = $this->get('dynamic_form.factory')->createForm('new_user');

        $form->isSubmitted(); // never works. Not after submission.

        // replace this example code with whatever you need
        return $this->render('default/index.html.twig', array(
            'form' => $form->createView(),
        ));
    }
<form action="/" method="POST">
    {{ form_widget(form) }}
    <button type="submit" class="btn btn-primary">Speichern</button>
</form>
fernandocarletti commented 8 years ago

Hello,

You need to tell your form to handle the request:

$form->handleRequest($request);

Cheers.

HellPat commented 8 years ago

Thanks. So stupid… too late :-D