Как отправить форму, загруженную в BootstrapDialog Modal
Я загрузил свою страницу редактирования в модальное диалоговое окно, используя BootstrapDialog https://github.com/nakupanda/bootstrap3-dialog но как мне получить кнопку отправки из BootstrapDialog для отправки формы?
Вот скрипка проблемы. http://jsfiddle.net/philphil/ru1t1nc6/15/
Отредактировать страницу
<form id="createEventForm" action="http://10.10.15.30:8000/attendee/edit" style="display:none" method="POST">
<label for="first_name">First_name:</label>
<input name="first_name" value="Chris" id="first_name" type="text" />
<label for="last_name">Last_name:</label>
<input name="last_name" value="Griffin" id="last_name" type="text" />
<input type="submit" />
</form>
JQuery
$(document).ready(function () {
var form = $('#createEventForm').html();
BootstrapDialog.show({
title: 'Title',
message: form,
buttons: [{
label: 'Update'
}]
});
});
1 ответ
Решение
Как насчет добавления действия к вашей кнопке:
http://jsfiddle.net/ru1t1nc6/17/
BootstrapDialog.show({
title: 'Title',
message: form,
buttons: [{
label: 'Update',
action: function(dialog) {
// submit the form
$('form').submit()
}
}]
});