Using inline formsets, if hideLastAddForm is set to true, and the formset is saved without adding a first form, clean() is still called on the hidden form, which can lead to form errors which are not shown.
I would suggest something like the following, which works in my specific:
if (options.hideLastAddForm) {
var row= $('.' + options.formCssClass + ':last');
var del = row.find('input:hidden[id $= "-DELETE"]');
del.val('on');
row.hide();
}
moreover, to prevent hiding the last form when form validation fails, in the template I have to set the hideLastAddForm only for the GET method:
{% if request.method == "GET" %} hideLastAddForm: true, {% endif %}
Unfortunately, my knowledge of the relevant use cases for django-dynamic-formset (and JS in general) is insufficient to open a pull request..
Using inline formsets, if hideLastAddForm is set to true, and the formset is saved without adding a first form, clean() is still called on the hidden form, which can lead to form errors which are not shown. I would suggest something like the following, which works in my specific:
moreover, to prevent hiding the last form when form validation fails, in the template I have to set the hideLastAddForm only for the GET method:
{% if request.method == "GET" %} hideLastAddForm: true, {% endif %}
Unfortunately, my knowledge of the relevant use cases for django-dynamic-formset (and JS in general) is insufficient to open a pull request..