Friday, December 30, 2011

Re: Show deactived radio button on a form

I think you may need a HTML or JS solution here. Check out this SO post http://stackoverflow.com/questions/1953017/why-cant-radio-buttons-be-readonly

Cheers,


On 31 December 2011 05:29, CrabbyPete <pete.douma@gmail.com> wrote:
I have the following form:

DEAL_CHOICES = [
               ('Standard','Standard'),
               ('Sponsored','Sponsored'),
               ('Trial' ,'Trial')
              ]

class ApplyForm(forms.Form):

   deal_type        = forms.ChoiceField( required = True,
                                         choices=DEAL_CHOICES,

widget=forms.RadioSelect(attrs={'class':"termscode"})
                                       )

   def __init__(self, *args, **kwargs):
       super(ApplyForm, self).__init__(*args, **kwargs)

If a trial is no longer available, I want to show it, but as a
deactivated choice. Can I do it, and is there a way to pass argument
to the init function to tell it to do so?

I tried ApplyForm( trial = False), but it causes the super(ApplyForm,
self).__init__(*args, **kwargs)
to blow up.



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