Hi! The "getRawValue" work-around didn't work (cannot call getRawValue on a non-object) but the SafeDecorator one worked fine! If it doesn't take much time, I would like to understand what was causing this bug and why using the SafeDecorator fixed it. I'm new to Symfony2 and trying to understand the framework.
I might as well introduce myself... I'm a C++ programmer (3d engines) with 10 years of experience getting started on a web project and I'm learning php + javascript. Thanks! Stephane On Tue, Sep 7, 2010 at 9:39 AM, Greg Thornton <g...@remarkablewit.com>wrote: > There are a few work-arounds. When passing your form to the view, you can > wrap it in a Symfony\Component\OutputEscaper\SafeDecorator object: > > return $this->render('ExampleBundle:Test:create', array('form' => new > SafeDecorator($form))); > > or you can use the getRawValue() method on the automagically created > escaper objects in your view: > > <?php echo $form->renderFormTag('#')->getRawValue() ?> > > or you can also mark the entire Form class (preferably just your child > class) as "safe" using the static > Symfony\Component\OutputEscaper\Escaper::markClassAsSafe($className) method > anywhere you want. > > There's no documentation on the OutputEscaper (that I could find) so all I > can say is that it works for me. Good luck! > > Greg Thornton > > On Sep 6, 2010, at 10:31 PM, Stephane wrote: > > > I'm getting that too and cannot find a work-around. I'm guessing this > > is PR3 current state because I _just_ got my src from the head > > revision of the PR3 branch, right off github. > > > > Stephane > > > > On Aug 28, 6:14 pm, Tomen Meta <tommi.enen...@gmail.com> wrote: > >> I checked out the current PR3 Branch from symfony-sandbox and tried to > >> build a Form with it (since it didnt work for me with PR2). > >> > >> My controller contains a register action: > >> > >> public function registerAction() > >> { > >> $user = new User(); > >> > >> $form = new Form('user', $user, > $this->container->getValidatorService()); > >> > >> $form->add(new TextField('name')); > >> $form->add(new Textfield('password')); > >> > >> return $this->render('MapEditorBundle:User:register', > >> array('form' => $form)); > >> } > >> > >> The view itself is just like in the tutorial: > >> > >> <?php $view->extend('MapEditorBundle::layout') ?> > >> > >> <?php echo $form->renderFormTag('#') ?> > >> <?php echo $form->renderErrors() ?> > >> <?php echo $form->render() ?> > >> <input type="submit" value="Send!" /> > >> </form> > >> > >> I get some output, however, the html is escaped, this is an example of > >> the html source: > >> > >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > >> <html> > >> <head> > >> <meta http-equiv="Content-Type" content="text/html; > >> charset=utf-8" /> > >> <title>Elenears Erben - Map Editor</title> > >> </head> > >> <body> > >> > >> <h1>Hello Application</h1> > >> > >> <form action="#" method="post"> > >> <table> > >> <tr> > >> <td><label for="user_name">Name</ > >> label></td> > >> <td> > >> <input id="user_name" name="user[name]" > >> value="" type="text" /> > >> </td></tr> > >> <tr> > >> <td><label for="user_password">Password</ > >> label></td> > >> <td> > >> <input id="user_password" name="user[password]" > >> value="" type="text" /> > >> </td></tr> > >> </table> > >> <input type="submit" value="Send!" /> > >> </form> > >> > >> <!-- START of Symfony 2 Web Debug Toolbar -- > >> > >> Is this a current issue with the PR3 branch or is there something > >> wrong with my code? > > > > -- > > 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<symfony-users%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > > http://groups.google.com/group/symfony-users?hl=en > > -- > 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<symfony-users%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- # Stéphane -- 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