Wednesday, December 28, 2011

Re: Django - Forms Widget TypeChoiceField - how to set id for two radio buttons

@ Mengu, Timothy Makobu: tnx for your replies.
this is the custom renderer class: pastebin.com/9x8HPgT1 ....but
honestly i have not understand where to modify the code since it's
just a code snippet found on the internet.
I also tried to modify the usertype parameter in the form, passing
with it the two attrs dictionaries (since i need two different ids and
name for each radiobutton) but it didnt worked...any help?

On 27 Dic, 08:39, Timothy Makobu <makobu.mwambir...@gmail.com> wrote:
> Try this:
>
> widget=forms.RadioSelect(renderer=HorizRadioRenderer,
> attrs={"id":"whatever_you_want"})
>
>
>
>
>
>
>
> On Tue, Dec 27, 2011 at 3:08 AM, Mengu <whalb...@gmail.com> wrote:
> > hi luke,
>
> > instead of setting auto_id to False, you should give it a string
> > parameter. please read more on
>
> >https://docs.djangoproject.com/en/dev/ref/forms/api/#ref-forms-api-co...
> > .
>
> > all the best.
>
> > On 26 Aralık, 21:45, luke lukes <lordluk...@gmail.com> wrote:
> > > hi everyone. i'm using a form with a TypeChoiceField, this is the form
> > > code:http://pastebin.com/GHttrDyN. now i'm trying to set a custom id
> > > for the two radio buttons displayed but i havent found yet the right
> > > way. maybe it's possible set it during form instantiation (as i set
> > > auto_id=False) in the view, but it's just my assumption, anyway i
> > > haven't find anything helpful on the internet.any idea?
>
> > > thanx - luke
>
> > --
> > 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.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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

No comments:

Post a Comment