tags:

views:

135

answers:

2

How do I get the selected value from a form's ComboBox field? what is the model class that deals with ComboBoxes? ..

Thanks.

+1  A: 

There's no such thing as a ComboBox in Django (or in HTML). I assume you are talking about a ChoiceField, which renders a select control in HTML.

You access the value of a ChoiceField in exactly the same way as any other field, once the form has been submitted and validated - by accessing form.cleaned_data['fieldname'].

You should read the excellent documentation on forms.

Daniel Roseman
Sorry I didn't know that, and yes it can be access in that but how can I define the ChoiceField in my model.There;s no attribute called ChoiceField in models.
MMRUser
No, ChoiceField is a form field, not a model field.
Daniel Roseman
So how do I use a select control with Django models.. ?
MMRUser