symfony-collection: Incrementation doesn't work for

Hi,

When I add a

element in my custom form theme, the incrementation of my collection doesn’t works !

{% block PriceType_row %}
    {{ form_widget(form) }}
{% endblock %}

{% block PriceType_widget %}
    <tr>
        <td>
            {{ form_widget(form.quantityFrom, {'attr': {'class': 'form-control'}}) }}
        </td>
        <td>
            {{ form_widget(form.quantityTo, {'attr': {'class': 'form-control'}}) }}
        </td>
        <td>
            {{ form_widget(form.bestUnitPrice, {'attr': {'class': 'form-control'}}) }}
        </td>
        <td>
            {{ form_widget(form.getPaid, {'attr': {'class': 'form-control'}}) }}
        </td>
        <td>
            {{ form_widget(form.vatRate, {'attr': {'class': 'form-control'}}) }}
        </td>
    </tr>
{% endblock %}

{% block ProductType_widget %}
    {{ form_widget(form.prices) }}l
{% endblock %}

Thanks for your help ! 😃

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 30 (15 by maintainers)

Most upvoted comments

I have finally find the solution ! I had left the “jquery.collection.html.twig form theme”

exactly.

$('.collection-prices').collection({
   elements_selector: '> tr',
});

And now, everything works in JS but my collection is not in my entity 😦 There is nothing in my collection when I dump $product, $request or $_POST…

It’s a bit late so it will wait tomorrow! But I don’t forget it 👍

Ok, will look forward tonight.

I was looking for it too, it seems that I forgot it. I leave this issue open to add the doc and add a demo with a table.