2
In this html code of a Django project how to add a feature that the user will choose how many services they want and click on the button when finished choosing. In this application I can only choose one service at a time, I implemented SELECT2, I already implemented the tag 'Multiple' but I can’t choose more than 2 or more in the dropdown, I click on the service and already save the first value, the names with the services come from the Database. I need to select the services I want and then save them then, because the query continues and goes to another dropdown with vehicles of the service I chose but does not work the search as a whole. But how to do this if when I select 1 service the screen is reloaded because of the onchange event.
HTML
<h3><strong>Serviço</strong></h3>
<select id="servico_cad" name="servico_cad" multiple="multiple" onchange="saveValue(this);this.form.submit();">
{% for i in servico_cad %}
<option value='{{i}}'>{{i}}</option>
{% endfor %}
<option value='Todos'>Todos</option>
</select>
JS
$(document).ready(function() {
$("#servico_cad").select2({
closeOnSelect:false
});
I understood your comment, in my views.py the 'servico_cad' this type POST within an if, pq this 'servico_cad' option is part of a search.
– Allisson.exe