Creating some fields on the fly in django template

17 views
Skip to first unread message

Dina Dodin

unread,
Oct 24, 2021, 1:32:15 PM10/24/21
to Django users
Hi

i have forms (not using Models)
in some forms i want to introduce dropdown list for example in case some specific value is selected for another existing form field.

i tried something if found in google but nothing seems to work for me.

if someone can help me with it will be great!

in html template i get the form as this: {{ form.as_p }}
i want to show/hide a new field according to value i select of existing field value.

Ammar Mohammed

unread,
Oct 24, 2021, 1:58:33 PM10/24/21
to django...@googlegroups.com
Hello
In your case i wouldn't import all the form at once using, {{ form.as_p}} 

Instead try to import every single field of your form thenyou can use JavaScript to show and hide fields according to input because django can't do this kind of editing. 


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4974223a-7544-4934-8f1f-e07675590d44n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages