reset button

164 views
Skip to first unread message

Sebastián Richmond

unread,
Jun 18, 2014, 6:06:36 AM6/18/14
to django...@googlegroups.com
Hi,
I am interested in a reset buttion for a form.

I have this form.py


from django import forms

class ContactForm(forms.Form):
    topic = forms.ChoiceField(choices=TOPIC_CHOICES)
    message = forms.CharField()
    sender = forms.EmailField(required=False)


It adds a submit button by default but I like to add reset button and I don't know how to do it.

Thanks a lot

Tom Evans

unread,
Jun 18, 2014, 7:11:49 AM6/18/14
to django...@googlegroups.com
Just like it doesn't output the <form> tags around your form, Django
will never add any buttons by default - this is always left to you to
decide what, where and how you want your form to be submitted.

To make a reset button, simply put a <button> inside your <form> that
has a type of "reset". When you click the button, your browser will
reset the form to initial values.

Cheers

Tom
Reply all
Reply to author
Forward
0 new messages