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


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.
javascript html php forms symfony
utkarsh2k2 Oct 17 '17 at 12:47 on 2017-10-17 12:47
source share