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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -