Answers for "inline formset plus"

0

inline formset plus

<h3>FormSet example</h3>
{{ myformset.management_form }}
<div id="form_set">
    {% for form in myformset.forms %}
	    {{form.non_field_errors}}
		{{form.errors}}
        <table class='no_error'>
            {{ form }}
        </table>
    {% endfor %}
</div>
<input type="button" value="Add More" id="add_more">
<div id="empty_form" style="display:none">
    <table class='no_error'>
        {{ myformset.empty_form }}
    </table>
</div>
Posted by: Guest on December-19-2020
0

inline formset plus

$('#add_more').click(function() {
	var form_idx = $('#id_form-TOTAL_FORMS').val();
	$('#form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx));
	$('#id_form-TOTAL_FORMS').val(parseInt(form_idx) + 1);
});
Posted by: Guest on December-19-2020

Browse Popular Code Answers by Language