Thursday, January 31, 2013

Re: initial argument in forms not working for me

Weird HTML formatting in your message. Plain text fixes things.

The issue is the capital P in initial='Public'. The choices list looks like (value stored in the database, value displayed to the user). The choices that the RadioSelect looks for from the datase are 'public' and 'private'. 'Public' doesn't match either of them.

On Jan 27, 2013, at 10:44 PM, Nikhil Verma wrote:

> Sorry I made a typo in last email .
>
> Can anybody explain what mistake i am doing ?
>
> 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
> )
>
> Thanks
>
>
>
> On Mon, Jan 28, 2013 at 11:05 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
>
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
>
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
> --
> 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.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Peter of the Norse
RahmCoff@Radio1190.org



--
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