Hello All,

I am having a problem with my MultipleChoiceField. I have my model
field, form field and choices listed below. When I select choices 1-9,
the edit form shows that these choices have been checked (i.e. save
the form, then view the form for editing again, the previously checked
check boxes are checked and this works using CheckboxSelectMultiple or
the standard Multiple Select Widget). However, when I chose choices 10
or 11 (or beyond), the list gets saved to my table field just fine
([u'1', u'3', u'11']), but when I view the form for editing, choice 11
(UK) is not checked.

It appears that when my Choice is a two digit number (in string
format) it saves just fine, but when the html is being rendered for
the form, the checked attribute is not being checked properly for the
last items.

I also tried changing choice 1 to 12 and that broke it, but then
worked when changed back to 1. Everything saves fine in the table, but
is not rendered correctly and the template tag I wrote to display the
selected choices works just fine with those higher number choices.

MODEL FIELD

targetmarkets = models.CharField(max_length=255, blank=True)

TARGETMARKETS_CHOICES = (
        ('1', 'Europe'),
        ('2', 'Asia'),
        ('3', 'North America'),
        ('4', 'South America'),
        ('5', 'Africa'),
        ('6', 'Canada'),
        ('7', 'USA'),
        ('8', 'East Europe'),
        ('9', 'West Europe'),
        ('10', 'Australasia'),
        ('11', 'UK'),
)

FORM FIELD

targetmarkets = forms.MultipleChoiceField(required=False,
widget=forms.CheckboxSelectMultiple, choices=TARGETMARKETS_CHOICES)

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

Reply via email to