It's just styling you can style anyway you want.
May 5, 2018
4
Level 1
How to use Boostrap Modal to submit a form outside of Modal
I am trying to a form, but want to add a confirm feature. However, I don't like the confirm feature from javascript, I am looking for something like bootstrap modal, very pretty.
<form method="POST" action="{{ route('sms.store') }}">
@csrf
<div class="form-group">
<label for="message">Text Message:</label> <div class="pull-right"><span id="wordCount">0</span> / 160 Characters</div>
<textarea class="form-control" name="message" id="myText" autofocus></textarea>
</div>
<div class="form-group" style="text-align:center;">
<button type="submit" class="btn btn-primary">
{{ __('Send Message') }}
</button>
</div>
</form>
Modal Button
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
I read a lot of documents, most of them are submitting the form within the modal. Maybe I am using the wrong thing? Any good examples? Or suggestions? Thank you guys.
Level 67
Should be pretty simple. Just give your form an id
<form id="the-form" method="POST" action="{{ route('sms.store') }}">
Give the submit button an id
<button id="the-submit" type="submit" class="btn btn-primary">Save changes</button>
Then use jquery (since you're using bootstrap) to submit the form when the submit button is clicked.
$(function() {
$('#the-submit').on('click', function(e) {
$('#the-form').submit();
});
});
Please or to participate in this conversation.