javascript:
$("#id_report").on('change', function() {
var reportform = document.getElementById("status-form");
var live = document.getElementById("id_report");
if (live.checked == true){
reportform.submit();
}
});
forms.py
class Reportform(Form):
report = forms.BooleanField(widget=forms.CheckboxInput(),required=False, label="Report",initial=True)
template.html
<form action="." id="status-form" method="POST">{% csrf_token %}
<p>{{closedreport.report}}Show Reports</p>
</form>
I want to submit the form if check box is checked.By default the check box is checked,but form is not getting submitted.