I have a very strange error, and I can’t understand why. I have used Bootstrap since its release and am very familiar with how it works. I set up a form with buttons that launch the modals located at the bottom of the document. When you click on the button that launches the modal, it opens the modal, but refreshes the page by adding form elements / values to the URL, as if it was submitting the form using the method GET. When the page refreshes, the modal no longer opens, and the URL has all the form values in the request. I can’t understand for life why this is happening. The modal should open and the page should remain unaffected (except for the modal opening)
The following is the HTML for the form element and modal button:
<div class='form-group'>
<label class='control-label' for='store-name'>
Store Name:
</label>
<div class='controls'>
<input type='text' class='form-control' id='store-name' name='store-name'>
<button class='btn btn-default' data-toggle='modal' data-target="#storeName">Lookup</button>
</div>
</div>
and here is the HTML for the modal itself:
<div class="modal fade" id="storeName" tabindex="-1" role="dialog" aria-labelledby="storeName" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Stores</h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save</button>
</div>
</div>
</div>
</div>
All scripts / styles are included because the modal is really open, it simply redirects the page when this happens. Has anyone experienced an error like this, or had any idea what might cause it?
source
share