html - Input button in modal not submitting external form -
i have created inline formset django. once form filled out , user clicks submit
have coded in bootstrap modal pops reminder. footer of modal contains html input external form can submitted modal.
the problem having submit buttons not submit form can saved database , emailed. there way accomplish using modal?
template:
{% extends "reports/base.html" %} {% load static %} {% block body_block %} <font color="green"> <h4 >company</h4> </font> <h3>please enter nightly reports in form below.</h3> <br> <p>if add new line category, select <font color="blue">add new line item</font> under each category. when finished, click on <strong><font color="gray">save , email corporate</font></strong> button @ bottom of form.</h4> once form sent, form refresh information have entered. if notice error after sent form, edit error , click <strong><font color="gray">save , email corporate</font></strong> button again update , resend.</p> <br> <h5>if blank form, click <a href="{% url 'reports:storenightlyreports' %}"><font color="green"> here</font>.</a></h5> <br> <br> <div class="container-fluid"> <form class="form-inline" action="" method="post"> {% csrf_token %} {{ form }} <table class="table"> {{ formset_new.management_form }} <div> <br><h4><strong>new</strong></h4><br> {% include "reports/formsets.html" formset=formset_new formset_class_name='new' prefix="new" %} </div> </table> <table class="table"> {{ formset_renewal.management_form }} <div> <br><h4><strong>renewals</strong></h4><br> {% include "reports/formsets.html" formset=formset_renewal formset_class_name='renewal' prefix="renewal" %} </div> </table> </div> </form> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="{% static 'js/jquery.formset.js' %}"></script> <br> <div class="container"> <!-- trigger modal button --> <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#mymodal"><strong>submit</strong></button> <!-- modal --> <div class="modal fade" id="mymodal" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">before submit!!</h4> </div> <div class="modal-body"> <p>please review , make sure line items correct , <strong>"check if no new items"</strong> checked if there no new items catagory. if correct, please select <strong>save , email</strong> button.</p> </div> <div class="modal-footer"> <input type="submit" class="btn btn-primary" value="save , email corporate"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> </div> </div> </div> </div> </div> {% endblock %}
after researching html input element, found can use id
attribute id <form>
element , call id using form
attribute in <input>
element coded in bootstrap modal. relevant updated code below.
<div class="container-fluid"> <form id="formset" class="form-inline" action="" method="post"> <!--added id="formset" form element--> {% csrf_token %} {{ form }} <table class="table"> {{ formset_new.management_form }} <div> <br><h4><strong>new</strong></h4><br> {% include "reports/formsets.html" formset=formset_new formset_class_name='new' prefix="new" %} </div> </table> <table class="table"> {{ formset_renewal.management_form }} <div> <br><h4><strong>renewals</strong></h4><br> {% include "reports/formsets.html" formset=formset_renewal formset_class_name='renewal' prefix="renewal" %} </div> </table> </div> </form> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="{% static 'js/jquery.formset.js' %}"></script> <br> <div class="container"> <!-- trigger modal button --> <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#mymodal"><strong>submit</strong></button> <!-- modal --> <div class="modal fade" id="mymodal" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">before submit!!</h4> </div> <div class="modal-body"> <p>please review , make sure line items correct , <strong>"check if no new items"</strong> checked if there no new items catagory. if correct, please select <strong>save , email</strong> button.</p> </div> <div class="modal-footer"> <input type="submit" form="formset" class="btn btn-primary" value="save , email corporate"><!--added form id, form="formset" , input element--> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> </div> </div> </div> </div> </div>
hopefully others use research tool.
Comments
Post a Comment