Topic: Modal Form Prevent Closing
Ian Dexter Mendoza Siñel
asked 8 years ago
<div class="modal modal-child fade addNewRequestModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" data-modal-parent="#ViewDetailModal">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Add New Document</h4>
</div>
<div class="modal-body">
<label for="addDtDeadline" class="col-xs-2 col-form-label">Deadline:</label>
<div class="md-form form-group">
<i class="fa fa-calendar fa-sm prefix"></i>
<input type="datetime-local" id="addDtDeadline" required>
</div>
<label for="addDtCompanyName" class="col-xs-2 col-form-label">Company Name:</label>
<div class="md-form form-group">
<i class="fa fa-building prefix"></i>
<input type="text" id="addDtCompanyName">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-unique" onclick="addDocument()" data-dismiss="modal">Add</button>
<button type="button" class="btn btn-unique" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
function addDocument()
{
var addDtDeadline = $("#addDtDeadline").val();
var companyName = $("#addDtCompanyName").val();
if (new Date(addDtDeadline)=="Invalid Date") {
toastr["warning"]("Invalid Deadline");
$("#addDtDeadline").focus();
}
}
</script>
Please help.
Thank you in advance.
Regards,
Ian
Rafał Rogulski
answered 8 years ago
data-dismiss="modal"
attribute wich close modal.
Remove this and add in else statement #('id_modal').modal('hide');
Regards
Rafał
Ian Dexter Mendoza Siñel
answered 8 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No