When I use the latest and greatest GIT-Version of Symfony, the Form
fields are escaped in TWIG.

Excerpt from controller:
    public function departmentEditAction($name) {
        $em = $this->get('doctrine.orm.entity_manager');
        $department = $em->getRepository("Oncode\StarcsBundle\Entity
\Department")
                ->findOneBy(array('name' => $name));

        if(!$department) {
            throw new NotFoundHttpException($this->get('translator')-
>trans('This department does not exist.'));
        }

        $form = $this->get('form.factory')
                ->createBuilder('form', $department)
                ->add('id', 'hidden')
                ->add('name')
                ->getForm();
// ...
        return $this-
>render('OncodeStarcsAdminBundle:Department:departmentEdit.html.twig',
array(
            'form' => $form->createView(),
        ));

In the TWIG-Template:
...
        <tr>
            <td>
                <div>
                    {{- form_widget(form.name) }}
                </div>
                {{ form_rest(form) -}}
            </td>
            <td>
                <input type="submit" name="edit" value="{{ "edit"|
trans }}"/>
            </td>
        </tr>
...

The output on the HTML-source are the input-element-tags escaped:

<div>&lt;input type=&quot;text&quot; id=&amp;quot;form_name&amp;quot;
name=&amp;quot;form[name]&amp;quot;
required=&amp;quot;required&amp;quot; maxlength=&amp;quot;
255&amp;quot; value=&quot;uuu1w1&quot; /&gt;
                </div>
                &lt;input type=&quot;hidden&quot;
id=&amp;quot;form__token&amp;quot;
name=&amp;quot;form[_token]&amp;quot;
required=&amp;quot;required&amp;quot;
value=&quot;b23212312312340&quot; /&gt;
                                            &lt;input
type=&quot;hidden&quot; id=&amp;quot;form_id&amp;quot;
name=&amp;quot;form[id]&amp;quot;
required=&amp;quot;required&amp;quot; value=&quot;7&quot; /&gt;</td>
            <td>

-- 
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 users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to