Hey,

I'm using the newforms functionality to create my forms - so the
structure is something like this:

/////////////////
FORMS.PY
/////////////////

class RegisterForm(forms.Form):

        MONTH_CHOICES=(
                (0,'Month',),
                (1,'January'),
                (2,'February'),
                (3,'March'),
                (4,'April'),
                (5,'May'),
                (6,'June'),
                (7,'July'),
                (8,'August'),
                (9,'September'),
                (10,'October'),
                (11,'November'),
                (12,'December')
        )

dob_month = forms.ChoiceField(choices=MONTH_CHOICES)

/////////////////
VIEWS.PY
/////////////////

form = RegisterForm(request.POST)

if form.is_valid():
        return done(request)
else:
        form = RegisterForm()

/////////////////
TEMPLATE
/////////////////

<p>When is your birthday?<p>
{{ form.dob_month }}




I don't want a user to be able to select the first option (0, Month)
but can't figure out how to tell Django that selecting that option is
not valid. I can't see a way around this without manually creating the
select myself but then I have to do all my own custom validation and
it means newforms becomes a bit useless.

Any ideas? I've seen something about "invalid_choice" but can't find
any details on how to use this - hoping someone may have experienced
this problem also.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to