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