KnockoutJS/Bootstrap - Clearing modal form when closing modal using javascript
Date : March 29 2020, 07:55 AM
hope this fix your issue I have a Bootstrap Modal that contains a form for updating or creating an entity (Company in my example). Right now my issue is that if I view an entity using the modal, it doesn't clear out the fields when I close the modal by any means. Causing the form to still be populated if I then click a "Create" button, which should bring me up a blank modal. function ViewModel() {
var self = this;
// your previous code
$('#myModal').on('hide', function() {
self.clearCurrentCompany();
});
}
|
Yii bootstrap submit a form inside a modal window using the modal buttons
Tag : forms , By : Nandor Devai
Date : March 29 2020, 07:55 AM
should help you out I'm trying to submit a form from inside a modal window using the modal buttons in the modal-footer. The form itself is loaded through ajax from a link (controller/action). , Change code at model-footer as below: <div class="modal-footer">
<?php $this->widget('bootstrap.widgets.TbButton', array(
'type'=>'primary',
'label'=>'Save changes',
'url'=>'#',
'htmlOptions'=>array('onclick' => '$("#formID").submit()'),
)); ?>
<?php $this->widget('bootstrap.widgets.TbButton', array(
'label'=>'Close',
'url'=>'#',
'htmlOptions'=>array('data-dismiss'=>'modal'),
)); ?>
|
Fire a remote bootstrap modal when clicking a form submit button, remote modal content then has form data to be displaye
Tag : html , By : Boyer C.
Date : March 29 2020, 07:55 AM
Any of those help Was able to make it work but not remotely Bootstrap 3 buttons are submit type by default, so I used a standard one that fired a modal... button#submit.btn.btn-primary(name='submit' data-toggle="modal" data-target="#myModal") Submit
.modal.fade(id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true")
.modal-dialog.wide-modal
.modal-content
.modal-header
button.close(type='button', data-dismiss='modal', aria-hidden='true') ×
h4.myModalLabel.modal-title
| #{title}
.modal-body
#container(style="width:90%; height:400px;")
.modal-footer
button.btn.btn-primary(type='button', data-dismiss='modal') Close
script.
$(document).ready(function(){
if(#{strikeprices}){
$('#myModal').modal('show')
}
$('body').on('hidden.bs.modal', '.modal', function () {
$(this).removeData('bs.modal');
});
});
|
Clear Bootstrap Modal Form after cancel button is clicked inside Modal
Tag : html , By : Tim Benninghoff
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I have a bootstrap modal with some inputs that I want to clear and have the modal close if I click the cancel button. It will obviously reset if I refresh the page but I simply want to be able to enter some data into the form fields, click the Cancel button and have the modal immediately close, then once it is closed click to open the modal again and have the form fields be empty. , FormGroup has a method called reset(): this.modalForm.reset();
|
How to Submit Form into Bootstrap Modal (send POST method into Modal) Laravel
Date : March 29 2020, 07:55 AM
|