Friday, February 1, 2013

Re: initial argument in forms not working for me

On Mon, Jan 28, 2013 at 5:35 AM, Nikhil Verma <varma.nikhil22@gmail.com> wrote:
> Hi
>
> I am using django 1.4.3 and have a field in form
>
>
> PROFILE_TYPE = (
> ('public', 'Public'),
> ('private', 'Private'),
> )
> profile_type = forms.CharField(max_length=10, widget=RadioSelect
> (choices=PROFILE_TYPE),
> initial='Public',
> required=False
> )
>
> I want that when i open this form the radio button with choice public should
> be pre selected.
> Can anybody explain what mistake you are doing ?
>
> Thanks

You've specified the initial value as 'Public', which does not match
either of the allowed choices, 'public' and 'private'.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment