How to select one checkbox at one time DJANGO.

713 views
Skip to first unread message

Sunil Kothiyal

unread,
Jun 21, 2018, 6:15:34 AM6/21/18
to Django users
I want to show and hide text input box on checkbox selection. If someone select business should show textbox. Otherwise hide it.


TWO_CHOICES = (
('1', 'Business'),
('2', 'Indivitual'),
)

business_or_individual = forms.ChoiceField(required=True, widget=forms.CheckboxSelectMultiple,choices=TWO_CHOICES)

I and i am showing on the HTML form is
<form action="POST">
{{form.contactInformation.business_or_individual}}
<input type="text" name="orgnization_name">
</form>
Its showing--


Jason

unread,
Jun 21, 2018, 6:30:21 AM6/21/18
to Django users

Sunil Kothiyal

unread,
Jun 21, 2018, 6:48:02 AM6/21/18
to django...@googlegroups.com
Thank You. Its worked for me. 
But i am not able to show hide text input on radio button click.

Can you help me?

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cc986b50-899c-466b-a39a-2b1ffcfa8bfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks & Regards,

Sunil Kothiyal


Jason

unread,
Jun 21, 2018, 8:00:00 AM6/21/18
to Django users
If you want dynamic behavior on a page as a result of interaction, you're going to have to use javascript.  
Reply all
Reply to author
Forward
0 new messages