there have been several related posts here and through the net but i am not so good with javascript (and I´m pretty sure, it will end up in a JS solution) and dind't yet find a solution by reading them...
What i want, is to give user the option either to get displayed query results within a database application or get them directly exportet to their download-directories.
This is working as intended, but if user chooses option to have the results as a download, i want to show a modal bootstrap-modal with some further information.
my html-code for the button is:
<button class="btn btn-sm"
type="submit"
name="custom_query"
id="custom_query_button"
value="{{ custom_query }}"
>
make query
<span class="form-check form-switch float-end">
<label class="form-check-label" for="export_toggle2"
title="Abfrageergebnisse in Excel-Datei exportieren">
</label>
<input class="form-check-input pe-2" type="checkbox" id="export_toggle2"
name="export"
value="custom_query"
style="cursor: pointer">
</span>
</button>
my code for the Bootstrap-modal is:
<div class="modal fade" id="QueryModal" tabindex="-1" role="dialog" aria-labelledby="QueryModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="QueryModalLabel">Done!</h5>
</div>
<div class="modal-body">
.....
</div>
<div class="modal-footer">
<button type="button" class="btn" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
So if i put the
data-toggle="modal" data-target="#QueryModal"
no matter where in this code, i get the modal alwas i push the button or even worse always i toggle the switch...
The goal would be, that the modal only shows up if the button is pushed with a toggled switch in "checked" position...