0

i used CollectionType with FileType. Everything is working good but problem is with render this after validation error.

I tried to write code with help of this article: http://growingcookies.com/easy-multiple-file-upload-in-symfony-using-the-collectiontype-field/

Symfony documentation dont have anything about render after validation error.

        {% set pos = 0 %}
{% for doc in form.images %}
    <div class="image-button-block">
        <button type="button" class="btn btn-danger btn-sm remove-image-button" onclick="removeFile($(this));"><i class="fa fa-times" aria-hidden="true"></i></button>
        <div style="display: none">
            {{ form_row(doc) }}
        </div>
    </div>

    {% set pos = pos + 1 %}
{% endfor %}

After that when i send this form one more time with fixed validation error. I got null in images array.

Raptor2
  • 11
  • 2
  • The fields get reset, see [here](https://stackoverflow.com/questions/16747278#16791646) and [here](https://stackoverflow.com/questions/1696877#1696884). If this is not your problem, you'll have to add a little bit more details. – msg Apr 19 '20 at 18:50
  • So you want to tell me i can't fill fileInput after site reload? – Raptor2 Apr 19 '20 at 18:57
  • I dont *want* to, but as far as I know that's how it is. See a [more elaborate answer](https://stackoverflow.com/questions/20537696#20537822). After digging for a bit, I found [this answer](https://stackoverflow.com/questions/47119426#47172409) that hints that it's now possible, but that's news to me and I'm not sure it fits this usecase. – msg Apr 19 '20 at 19:28

0 Answers0