Answer the question
In order to leave comments, you need to log in
There is a form with three fields. Is it possible to make the second field a dropdown dependent list of the first one?
There is a form with three fields. Let's call them service, action and input.
class InputsExtendedForm(forms.Form):
#action = models.ForeignKey(Action)
service = forms.CharField(max_length=15, widget=forms.Select(choices=SERVICE_CHOICES))
action_form = forms.CharField(label='Action', max_length=15)
input_form = forms.CharField(label='Input', max_length=1000)
SERVICE_CHOICES = (
('Apps', 'Apps'),
('Auth', 'Auth'),
('Book', 'Book'),
Answer the question
In order to leave comments, you need to log in
Redefine the model and make another class action_form. Through a one-to-many(service-action_form) relationship
I solved a similar problem through java script and onChange event. When changing the main select, you need to either do ajax to the server for data for the dependent select, or process a previously saved list of all possible values from some variable that is declared when the page is first rendered.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question