我最近一直在使用
java / jboss进行叽叽.witter boot been.,and and and and……………………….
这种形式在模态本身是外在的,我根本无法弄明白这是怎么可能的
我已经尝试将模态本身添加到窗体中,尝试使用HTML5 form =“form_list”,甚至将窗体添加到模态体,并使用一些jquery强制提交,但没有任何显示工作
下面是一个示例模式,我试图增加我需要的,OK按钮以前编辑尝试调用jquery函数.
- <div class='modal small hide fade' id='myModal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
- <div class='modal-header'>
- <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>
- <h3 id='myModalLabel'>Delete Confirmation</h3>
- </div>
- <div class='modal-body'>
- <p class='error-text'>Are you sure you want to delete the user?</p>
- </div>");
- <div class='modal-footer'>
- <button class='btn btn-danger' data-dismiss='modal' aria-hidden='true'>Cancel</button>
- <button class='btn btn-success' data-dismiss='modal'>Ok</button>
- </div>
- </div>
解决方法
提交后要关闭模式吗?在窗体内部的模态或外部,你应该能够使用jQuery ajax来提交表单.
这里是一个模式中的形式的例子:
- <a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>
- <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <h3 id="myModalLabel">Modal header</h3>
- </div>
- <div class="modal-body">
- <form id="myForm" method="post">
- <input type="hidden" value="hello" id="myField">
- <button id="myFormSubmit" type="submit">Submit</button>
- </form>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
- <button class="btn btn-primary">Save changes</button>
- </div>
- </div>
和jquery ajax获取表单域并提交..
- $('#myFormSubmit').click(function(e){
- e.preventDefault();
- alert($('#myField').val());
- /*
- $.post('http://path/to/post',$('#myForm').serialize(),function(data,status,xhr){
- // do something here with response;
- });
- */
- });
工作在Bootply:http://bootply.com/59864