Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
109
rated 0 times [  116] [ 7]  / answers: 1 / hits: 19474  / 9 Years ago, tue, june 30, 2015, 12:00:00

I just created a django form using this following documentation:https://docs.djangoproject.com/en/1.8/topics/forms/



My Forms.py is similar to this:



from django import forms

class NameForm(forms.Form):
your_name = forms.CharField(label='Your name', max_length=100)


My Html template is similar to this (from django doc):



<dialog id=addForm>
<form action={% url listing %} method=post >
{% csrf_token %}
{{ form }}

<input id=task_submit type=submit value=Submit/>
</form>
</dialog>

<button onlick=PopUp()>Add Listing </button>

<script>

function PopUp(){
document.getElementByID(addForm).showModal();
}

</script>


However, I want my form to be a pop up dialogue when a user clicks on a button called add tasks. I do not want the form to show until the user clicks a button called add tasks. I have not been able to find any methods so far to do so while using Django Forms.



Question: How do I implement a pop up dialogue to display my current django form when a user clicks on a button?


More From » jquery

 Answers
2
[#65980] Sunday, June 28, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hadens

Total Points: 142
Total Questions: 98
Total Answers: 100

Location: Kenya
Member since Mon, Jun 14, 2021
3 Years ago
;