Ajax 在引导远程模式窗体中启用验证
如何在包含表单的引导“远程”模式上进行验证Ajax 在引导远程模式窗体中启用验证,ajax,twitter-bootstrap,validation,jquery-validate,Ajax,Twitter Bootstrap,Validation,Jquery Validate,如何在包含表单的引导“远程”模式上进行验证 jQuery验证不会自动应用于以“远程”引导模式加载的表单。因为表单在DOM中不存在,我们需要让验证程序重新分析新添加的内容。幸运的是,Bootstrap有一个在显示modals之后触发的事件 $(document).on("shown.bs.modal", function (e) { $.validator.unobtrusive.parse(document); }); 注意:事件名称使用“已显示”而不是“显示” 如果页面上混合了本地和
jQuery验证不会自动应用于以“远程”引导模式加载的表单。因为表单在DOM中不存在,我们需要让验证程序重新分析新添加的内容。幸运的是,Bootstrap有一个在显示modals之后触发的事件
$(document).on("shown.bs.modal", function (e) {
$.validator.unobtrusive.parse(document);
});
注意:事件名称使用“已显示”而不是“显示”
如果页面上混合了本地和远程模态,您可能希望通过向模态div添加一个类(如“remotemodalform”)来限制对远程模态的调用
$(".remote-modal-form").on("shown.bs.modal", function (e) {
$.validator.unobtrusive.parse($(".remote-modal-form"));
});
由于表单在DOM中不存在,我们需要让验证器重新分析新添加的内容。幸运的是,Bootstrap有一个在显示modals之后触发的事件
$(document).on("shown.bs.modal", function (e) {
$.validator.unobtrusive.parse(document);
});
注意:事件名称使用“已显示”而不是“显示”
如果页面上混合了本地和远程模态,您可能希望通过向模态div添加一个类(如“remotemodalform”)来限制对远程模态的调用
$(".remote-modal-form").on("shown.bs.modal", function (e) {
$.validator.unobtrusive.parse($(".remote-modal-form"));
});
由于表单在DOM中不存在,我们需要让验证器重新分析新添加的内容。幸运的是,Bootstrap有一个在显示modals之后触发的事件
$(document).on("shown.bs.modal", function (e) {
$.validator.unobtrusive.parse(document);
});
注意:事件名称使用“已显示”而不是“显示”
如果页面上混合了本地和远程模态,您可能希望通过向模态div添加一个类(如“remotemodalform”)来限制对远程模态的调用
$(".remote-modal-form").on("shown.bs.modal", function (e) {
$.validator.unobtrusive.parse($(".remote-modal-form"));
});
由于表单在DOM中不存在,我们需要让验证器重新分析新添加的内容。幸运的是,Bootstrap有一个在显示modals之后触发的事件
$(document).on("shown.bs.modal", function (e) {
$.validator.unobtrusive.parse(document);
});
注意:事件名称使用“已显示”而不是“显示”
如果页面上混合了本地和远程模态,您可能希望通过向模态div添加一个类(如“remotemodalform”)来限制对远程模态的调用
$(".remote-modal-form").on("shown.bs.modal", function (e) {
$.validator.unobtrusive.parse($(".remote-modal-form"));
});