-1
I have a modal with some tabs referring to account closure, I need to save the user’s choices, I load types of payments, type of flags etc, each button can have an id, that id I want to save, I just don’t know where to put. In the last tab I will give a Ubmit and I need to know all the choices of the user, for example: DEBITO > NETWORK> VISA. I just don’t know how to store it for Django. Has anyone worked on any similar logic ?
<div id="card_pos_modal" class="modal fade">
<div class="modal-dialog modal-lg" style="width:80%">
<div class="modal-content">
<div class="modal-body">
<div class="well">
<ul class="nav nav-tabs" id="myTab">
<li class="nav-item"><a href="#tab1" data-toggle="tab">TIPO DE CARTÃO</a></li>
<li class="nav-item"><a href="#tab2" data-toggle="tab">ADQUIRENTE</a></li>
<li class="nav-item"><a href="#tab3" data-toggle="tab">BANDEIRA</a></li>
<li class="nav-item"><a href="#tab4" data-toggle="tab">VALOR</a></li>
</ul>
<div id="myTabContent" class="tab-content ">
<div class="tab-pane" id="tab1">
<form class="form-horizontal" action='' method="POST">
{% for method in methodpay %}
<div class="btn-group">
<button type="button" class="btn btn-info btn-lg method" >{{ method.methodpay_short_name method.id }}</button>
</div>
{% endfor %}
</form>
</div>
<div class="tab-pane" id="tab2">
<form class="form-horizontal" action='' method="POST">
{% for acquire in acquirer %}
<div class="btn-group">
<button type="button" class="btn btn-info btn-lg acquirer" >{{ acquire.acquirer_short_name acquire.id }}</button>
</div>
{% endfor %}
</form>
</div>
<div class="tab-pane" id="tab3">
<form class="form-horizontal" action='' method="POST">
{% for mode in modepay %}
<div class="btn-group">
<button type="button" class="btn btn-info btn-lg mode" >{{ mode.payment_short_name mode.id }}</button>
</div>
{% endfor %}
</form>
</div>
<div class="tab-pane" id="tab4">
<form class="form-horizontal" action="{% url 'insert_value' %}" method="POST"> {% csrf_token %}
<center>
<div class="btn-group">
<input id="value_insert_n" name="insert_value" type="number" step="0.010" style="width:250px;font-size: 40px" autofocus>
</div>
</center>
<center>
<label><input id="typepay_code" name="typepay_code" value="{{ typepay_code }}" type="hidden"></label>
<button type="submit" class="btn btn-primary" >OK</button>
</center>
</form>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Mark, I put the buttons inside a form in these tabs but it has no effect, it does not call the url, I do not know if it is pq I have a logic JS that does all the flow, the buttons of the first tab take the user to the second and so on.
– Rodolfo Sousa
in Django if you are going to use css and javascript you have to mark with {% load Static %} and within this tag add your js script, because without it it does not work, you cannot place javascript without being inside a Django tag because it will not render this part. see if this link helps: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Home_page
– marcos paulo silva viana
see another example how to load static files on Django:https://developmentberto.org/2015/01/23/django-usando-javascript-python-linuxpages/
– marcos paulo silva viana