submit django form on checkbox select
django, django-forms, django-views, javascript
Solution
I found the solution,
class SearchKeyword(Form):
search_keyword = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Keyword Search','class':'keyword-search'}))
status = forms.BooleanField(widget=forms.CheckboxInput(attrs={'onclick':'this.form.submit();'}),required=False, label="Status")
Problem
tml: ``` <div id="report-liveonly"> <form action="." id="status" method="POST">{% csrf_token %} <p>{{SearchKeywordForm.status}}Only show LIVE reports</p> </form> </div> ``` I am trying to submit the searchform on checkbox click.It is not working. Onclick also not happening,i checked with alert message. The total function is to show the live report,if `Only show LIVE reports` checkbox is checked. Need help