javascript - submit django form on checkbox select - Stack Overflow

tml:<div id="report-liveonly"><form action="." id="status" metho

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

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

Share Improve this question edited Jul 24, 2013 at 10:29 user2086641 asked Jul 19, 2013 at 8:20 user2086641user2086641 4,37115 gold badges59 silver badges96 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 9

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")

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744273949a4566236.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信