On Fri, 2008-09-05 at 03:11 -0700, mwebs wrote:
> Hello,
> 
> I use a modelchoicefield and want to remove the entry that represents
> "no item selected"(<option value="">------</option>), because in my
> scenario I will only allow to select between existing entries.

Specify a default value for the field (one of the choices). Then that
will be shown as the initially selected option.

The empty choice isn't there because it's a valid option. It's actually
a useful user-interface feature. If somebody submitted a form without
making a choice, it would be invalid because the empty "----" choice is
not valid. It's there because you didn't specify a default value and
Django doesn't make a choice of default initial value for you. The user
has not yet made a selection, so they must choose one of the options
explicitly. If they just hit "submit" without making a choice, Django is
careful to ensure they don't accidentally end up selecting whichever
option Django displayed first.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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