Dear All

I have a choiceField in one of my forms, and I'd like to have it
rendered displaying a prompt.  I think the html would be something
like this:

    <select>
        <option value="">Please choose a colour:</option>
        <option value="r">Red</option>
        <option value="g">Green</option>
        <option value="b">Blue</option>
    </select>

This would display a drop-down menu showing "Please choose a colour:".

The form field would be something like this:

    colours = (('r','Red'),('g','Green'),('b','Blue))
    # ...
    fave_colour = forms.ChoiceField(choices=colours)

The problem is, this displays one of the choices.  I'd much prefer a
prompt (in fact for our application, displaying one of the choices, as
if it were a kind of 'default', is not at /all/ appropriate).

I've tried

    fave_colour = forms.ChoiceField(label="Please choose a colour:"
                                    choices=colours)

and

    fave_colour = forms.ChoiceField(initial="Please choose a colour:"
                                    choices=colours)

and I've scoured the net for clues, but found nothing which works.

Please can anyone here help me work out how to do this with
django.forms?

With thanks and best wishes

Ivan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to