Michael schrieb:
> When specifying the choices parameter is there a way to mark say, for
> example, the first choice as invalid?
>
> e.g.
>
> TOPIC_CHOICES = (
> ('erroneous', '-- pick one --'), # <-- I would not want this
> choice to count as being valid
> ('general', 'General enquiry'),
> ('bug', 'Bug report'),
> ('suggestion', 'Suggestion'),
> )
>
> class ContactForm(forms.Form):
> topic = forms.ChoiceField(choices=TOPIC_CHOICES)
>
TOPIC_CHOICES=[('', '-- pick one --'), ('key1', '...'), ...]
And required=False for the ChoiceField (which is the default).
Thomas
--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de