lol I had originally tried that too. Nothing seems to work! I am thinking my logic might be wrong from the start.
What I am doing is taking the request.POST.getlist('lookingfor') array[] and storing it as a comma delimited string in the database (Textfield), then returning the selected by plugging the array into the "initial" dictionary. But nothing seems to be working :-( -------------------------------------------------- From: "Malcolm Tredinnick" <malc...@pointy-stick.com> Sent: Friday, January 09, 2009 8:38 PM To: <django-users@googlegroups.com> Subject: Re: setting the checkboxes (MultipleChoiceField problem) > > On Fri, 2009-01-09 at 20:29 -0600, Tolu wrote: >> I tried this. The checkboxes displayed but none of them were checked: >> >> LOOKING_FOR = ( >> ('Friendship', 'Friendship'), >> ('Dating', 'Dating'), >> ('A Relationship', 'A Relationship'), >> ('Networking', 'Networking'), >> ) >> >> class ProfileForm(forms.ModelForm): >> lookingfor = forms.MultipleChoiceField(required=False, label='Looking >> For', widget=forms.CheckboxSelectMultiple, choices=LOOKING_FOR, initial= >> {"lookingfor": [1,2,3]}) > > The values in your choices list don't contain 1, 2 or 3! They are > strings like 'Friendship', etc. You have to specify things that are the > first elements in those 2-tuples you specify for choices. > > 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---