Hi all. I'm using python2.5 / django .96x (yes i know - we're
upgrading soon). I have an issue with a multiplechoice field which I
can't figure out. Here are snippets
from the form:
# disaster choices previously defined
Disaster=forms.MultipleChoiceField (required=True,
choices=Disaster_Choices, label="Disaster(s)",
widget=forms.CheckboxSelectMultiple(attrs={'class':'multibox'}))
from the model:
Disaster = models.CharField (max_length=20,
blank=False,db_index=True)
from the view:
mydata = Record (
Disaster = CleanMe(request.POST.get('Disaster','')),,
Active = 0)
mydata.save()
Ok so here's what's going on.... There are 4 disasters which appear as
checkboxes on the form. This works great. When the form is
submitted, I run the form field through a little function called
CleanMe which strips out certain character combinations. I do an
assert here right before the mydata = line to view what was submitted
off of the form for the disaster options.
If I select Earthquake, Tornado, Hurricane, I would expect to pass in
EQ, TO, HU to the view. However, only HU is being passed to the
view. No matter how many I select, only the last option is being
passed.
I'm obviously not doing something correctly but can someone point me
in the right direction here?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---