我有一个我希望提交的表单,但是一旦用户点击提交按钮,它将显示一个Twitter引导模式,它将继续处理表单或将其取消回表单页面.是否可以将常规
javascript确认转换为bootstrap模式?
<form action="http://localhost.testing/modal-processing.PHP" class="form-horizontal" role="form" method="GET"> <label>Landlord<span class="mandatory">*</span></label> <select class="form-control input-sm chosen chzn-select" tabindex="1" data-placeholder="Choose a landlord" data-rule-required="true" name="landlord_id" id="landlord_id"> <option value=""></option> <option value="31" >Liam Lawlor</option> <option value="34" >Damian Lavelle</option> <option value="35" >Mick Lally</option> <option value="36" >Joanne Lavelle</option> <option value="37" >Liam Lacey</option> <option value="38" >Laura Luney</option> <option value="39" >Lenihan Enterprises</option> </select> <!-- modal caller --> <a href="#modal-dialog" class="modal-toggle" data-toggle="modal" data-href="http://localhost.testing/modal-processing.PHP" data-modal-type="confirm" data-modal-title="Delete Property" data-modal-text="Are you sure you want to delete {$property.address_string}?" data-modal-confirm-url="{$base_url}residential-lettings/properties/do-delete/property/{$property.id}"><i class="icon-trash"></i> Modal Submit</a> <!-- proper submit --> <input type="submit"> </form>
解决方法
您可以通过启用模式中的链接/按钮(即:’btnYes’)来使用Bootstrap模式作为确认,该模式用于通过jQuery触发表单提交…
$('#btnYes').click(function() { // handle form processing here $('form').submit(); });
这是一个有效的演示:http://bootply.com/88094