如何提交加载到BootstrapDialog模式中的表单

时间:2014-12-18 22:51:55

标签: jquery forms bootstrap-dialog

我使用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 个答案:

答案 0 :(得分:1)

如何为按钮添加操作:

http://jsfiddle.net/ru1t1nc6/17/

    BootstrapDialog.show({
        title: 'Title',
        message: form,
        buttons: [{
            label: 'Update',
            action: function(dialog) {
                // submit the form
                $('form').submit()
            }
        }]
    });
相关问题