We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The script wrapper for prototypes from Pull#1188 creates problems for nested collections.
It will put a <script></script> within a <script></script> causing the closing tag of the second embedded prototype to close the first prototype.
See below for some POC code that replicates the issue:
namespace Acme\BugBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller, Sensio\Bundle\FrameworkExtraBundle\Configuration as Extra ; use Acme\BugBundle\Form\Type\Level1Type; class DefaultController extends Controller { /** * @Extra\Template() */ public function indexAction() { $form = $this->get('form.factory')->create(new Level1Type()); return array( 'form' => $form->createView(), ); } }
{{ form_widget(form) }} <input type="submit" value="submit" />
namespace Acme\BugBundle\Form\Type; use Symfony\Component\Form\AbstractType, Symfony\Component\Form\FormBuilder ; class Level1Type extends AbstractType { public function buildForm(FormBuilder $builder, array $options) { $builder ->add('startlevel1', 'text') ->add('level2', 'collection', array( 'type' => new Level2Type(), 'allow_add' => true, )) ->add('endlevel1', 'text') ; } }
namespace Acme\BugBundle\Form\Type; use Symfony\Component\Form\AbstractType, Symfony\Component\Form\FormBuilder ; class Level2Type extends AbstractType { public function buildForm(FormBuilder $builder, array $options) { $builder ->add('startlevel2', 'text') ->add('level3', 'collection', array( 'type' => new Level3Type(), 'allow_add' => true, )) ->add('endlevel2', 'text') ; } }
namespace Acme\BugBundle\Form\Type; use Symfony\Component\Form\AbstractType, Symfony\Component\Form\FormBuilder ; class Level3Type extends AbstractType { public function buildForm(FormBuilder $builder, array $options) { $builder ->add('startlevel3', 'text') ; } }
<div id="level1"><input type="hidden" id="level1__token" name="level1[_token]" value="bad35568f69514b59265a4ff15b04548f6168658" /><div><label for="level1_startlevel1">Startlevel1</label><input type="text" id="level1_startlevel1" name="level1[startlevel1]" required="required" value="" /></div><div><label >Level2</label><div id="level1_level2"><script type="text/html" id="level1_level2_prototype"><div><label >$$name$$</label><div id="level1_level2_$$name$$"><div><label for="level1_level2_$$name$$_startlevel2">Startlevel2</label><input type="text" id="level1_level2_$$name$$_startlevel2" name="level1[level2][$$name$$][startlevel2]" required="required" value="" /></div><div><label >Level3</label><div id="level1_level2_$$name$$_level3"><script type="text/html" id="level1_level2_$$name$$_level3_prototype"><div><label >$$name$$</label><div id="level1_level2_$$name$$_level3_$$name$$"><div><label for="level1_level2_$$name$$_level3_$$name$$_startlevel3">Startlevel3</label><input type="text" id="level1_level2_$$name$$_level3_$$name$$_startlevel3" name="level1[level2][$$name$$][level3][$$name$$][startlevel3]" required="required" value="" /></div></div></div></script></div></div><div><label for="level1_level2_$$name$$_endlevel2">Endlevel2</label><input type="text" id="level1_level2_$$name$$_endlevel2" name="level1[level2][$$name$$][endlevel2]" required="required" value="" /></div></div></div></script></div></div><div><label for="level1_endlevel1">Endlevel1</label><input type="text" id="level1_endlevel1" name="level1[endlevel1]" required="required" value="" /></div></div> <input type="submit" value="submit" />
The text was updated successfully, but these errors were encountered:
I have opened a PR as a base for discussion: #1500
Sorry, something went wrong.
f29da2f
Successfully merging a pull request may close this issue.
The script wrapper for prototypes from Pull#1188 creates problems for nested collections.
It will put a <script></script> within a <script></script> causing the closing tag of the second embedded prototype to close the first prototype.
See below for some POC code that replicates the issue:
Using RC3
Controller
Template
Level1Type
Level2Type
Level3Type
generated markup
The text was updated successfully, but these errors were encountered: