javascript - django dropdownlist onchange submission -
i showing user dropdown list form:
class cronform(forms.form): days = forms.modelchoicefield(queryset=day.objects.all().order_by('day')) class day(models.model): day = models.charfield(max_length=200, default='') month = models.charfield(max_length=200, default='') def __unicode__(self): return self.day
and shown @ template way:
<form method="post" onchange=change()> {{ days }} </form>
what want submit form when user selects option dropdown list. example, user redirected new url, , internally program capture post data. find related <select>
tag, calling javascript function onchange of select element. select element in modelchoicefield form, don't know how it. appreciated!
solved following link
days = forms.modelchoicefield(queryset=day.objects.all().order_by('alias'), widget=forms.select(attrs={"onchange":'refresh()'}))
Comments
Post a Comment