Re: Select field with default text

2011-12-22 Thread Andre Terra
You could perhaps subclass ChoiceField to allow for custom empty_labels. This code is highly untested and written so casually it shouldn't be pasted anywhere. # your forms.py from django.forms.fields import ChoiceField class MyCustomChoiceField(ChoiceField): def __init__(self, *args, **kwarg

Re: Select field with default text

2011-12-22 Thread Tom Evans
On Thu, Dec 22, 2011 at 12:37 PM, talbronstien wrote: > Hi, > > I want to have a field in a form class which will render as select in > html. But, I want default text shown as "Select Blood Type". My > declaration is > > gender = forms.ChoiceField(required=False,choices = > USER_BLOOD_CHOICES). >

Select field with default text

2011-12-22 Thread talbronstien
Hi, I want to have a field in a form class which will render as select in html. But, I want default text shown as "Select Blood Type". My declaration is gender = forms.ChoiceField(required=False,choices = USER_BLOOD_CHOICES). But, if I add an option value in html, as Select Blood Type". I get an