I am showing the user a dropdown from this 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 this is shown on the template as follows:
<form method="post" onchange=change()> {{ days }} </form>
I want to submit this form when the user selects an option from the drop-down list. For example, a user can be redirected to a new URL, and inside the program will write POST data. But all I find is related to the <select> , for example, when calling the javascript function when replacing the select element. But since the select element is in the form of ModelChoiceField, I do not know how to do this. Any help would be greatly appreciated!
source share