i am trying to use django-dynamic-formset library to dynamically add forms to a formset. The library clones the form pretty well but it is not able to clone the value attribute of the submit input for some reason.
following is the formset that i am using django-dynamic-formset on.
{% if eduforms %}
{% for form in eduforms.forms %}
<div class="formset-form">
<form id="{{ form.prefix }}" method="POST">
<h4>Add a Project</h4>
{% csrf_token %}
{{ form.as_p }}
<div class="button-container right">
<input class="button" type="Submit" value="Update Information" />
</div>
</form>
<script type="text/javascript">
jQuery(document).ready ( function(){
jQuery('{{ form.prefix }}').validationEngine();
});
</script>
<div class="clearfix"></div>
</div>
{% endfor %}
{% endif %}
i have tried binding the function to the div#formset-form container as follows.
<script type="text/javascript" src="/static/js/jquery.formset.js"></script>
<script type="text/javascript">
$('.formset-form').formset();
</script>
is there something i am doing wrong ?
all you need to do is use the
keepFieldValuesoption of the jquery plugin that you are using and it will clone the values as well. So change:to