简体   繁体   中英

Submit button is not working in html using django

HTML FILE

in html page action is not added i wanted to know how i can submit the form without adding action attribute??

simply add your submit in the form tag:

<form method="post">
   {% csrf_token %}
   {{form.as_p}}
   <input type="submit" value="submit" class="btn btn-primary"/>
</form>

and if you don't want that, so use form= in submit:

<form method="post" id="this_form">
   {% csrf_token %}
   {{form.as_p}}
 </form>
<input type="submit" form="this_form" value="submit" class="btn btn-primary"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM