Configuring symfony3 data prototype

I have a built-in collection of forms with a custom prototype data attribute. This is how I set up the data prototype

My main twig file ( listingbedroomaddpage.html.twig ):

 <div class="bedrooms" data-prototype= "{% filter escape %} {{ include('EpitaHousingBundle:Listing:prototype.html.twig', { 'form': form.bedrooms.vars.prototype }) }} {% endfilter %}"> </div> 

My prototype.html.twig :

 <div class="row"> <div class="col-md-2">{{ form_label(form.rentamount, 'Rent') }}</div> <div class="col-md-2">{{ form_widget(form.rentamount) }}</div> <div class="col-md-1">{{ form_widget(form.rentcurrency) }}</div> <div class="col-md-2">{{ form_widget(form.rentduration) }}</div> <div class="col-md-3">{{ form_errors(form.rentamount) }}</div> <div class="col-md-1">{{ form_errors(form.rentcurrency) }}</div> <div class="col-md-1">{{ form_errors(form.rentduration) }}</div> </div> 

When I submit the form for the first time, prototype.html.twig is called and the inline form displays correctly. However, as soon as I submit the form, the structure of the branching form and the styling are gone. Here are snapshots before and after sending, respectively

enter image description here

enter image description here

I assume that prototype.html.twig will not be called after clicking the submit button. I am relatively new to this. Can anyone help me.

Thanks in advance. Let me know if you need more code to reproduce the problem.

+1
javascript html php forms symfony
Oct 17 '17 at 12:47 on
source share

No one has answered this question yet.

See similar questions:

47
How to set data-prototype attribute in Symfony 2 forms
0
Symfony add prototype inline empty string collection

or similar:

1949
How does JavaScript.prototype work?
1690
How does data binding work in AngularJS?
1567
Convert form data to javascript object using jQuery
1161
What does enctype = 'multipart / form-data' mean?
969
What are the nuances of prototype / prototype inheritance volume in AngularJS?
746
Using 'prototype' vs 'this' in JavaScript?
720
__proto__ VS. JavaScript prototype
10
Twig Form Theming - attribute of the form_label class
one
How to make input inside a label in Symfony2 using Twig
0
form_label () does not work with boolean type



All Articles