Thursday, March 3, 2011

HTML <select> size confusion.

Hi there,

In my ModelForm I have a fields like this:

argument = models.CharField (max_length=50, blank=True)
media = models.CharField (max_length=50, choices =
getChoices ('media'))

For the 'media' field, the max_length results in a HTML select such
as:

<select size="50" name="media" id="id_media">
<option value="">---------</option>
<option value="monkey.png">monkey.png</option>
<option value="shu-eumura-lcd.mpg">shu-eumura-lcd.mpg</option>
</select>

The problem here is that the max_length attribute has been passed to
the <select> size, which results in a very large select control. If
max_length specifies the database storage size, why is it also used as
the size attribute to <select>? (Or rather: what am I doing wrong
here?)

I'm using django 1.2.1.

Cheers!

Rob

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate