官方文檔:http://formvalidation.iohtml
var $formEntityProfileSearch = $("form[name=entityProfileSearch]");html5
var $formValidationEntityProfileSearch = $formEntityProfileSearch.data("formValidation");ajax
//初始化表單驗證json
$formValidationEntityProfileSearch.revalidateField('companyFullName');app
//支持單一字段從新驗證url
formValidationEntityProfileSearch.resetField();spa
//重置驗證字段orm
一個表單多個提交按鈕htm
formSubmit.off('success.form.fv.submit');blog
formSubmit.on('success.form.fv.submit', function(e) {
var $form = $(e.target), // Form instance
// Get the clicked button
$button = $form.data('formValidation').getSubmitButton();
switch ($button.attr('name')) {
case 'save':
e.preventDefault();
var formData = Utils.formArrayToObject(formSubmit.serializeArray());
formData.shippmentFee=oldshippmentFee;
var data = $.extend({},jsonresult,formData);
BootstrapDialog.confirm({
title: "發貨信息確認",
message: "肯定保存發貨信息嗎?",
type: BootstrapDialog.TYPE_DANGER,
callback: function(res) {
if(res){
Utils.ajax({
scope:formSubmit,
url:"./order/orderdelivery/save_order_delivery_information",
type:"POST",
dataType:"json",
contentType:"application/json",
data:JSON.stringify(data),
normalCallback:function(result){
BootstrapDialog.success("保存成功",function(){
dialog.close();
$dttbltaskorder.draw();
});
}
});
}
}
})
break;
case 'dispatching':
e.preventDefault();
var formData = Utils.formArrayToObject(formSubmit.serializeArray());
formData.shippmentFee=oldshippmentFee;
var data = $.extend({},jsonresult,formData);
BootstrapDialog.confirm({
title: "發貨確認",
message: "肯定發貨嗎?",
type: BootstrapDialog.TYPE_DANGER,
callback: function(res) {
if(res){
Utils.ajax({
scope:formSubmit,
url:"./order/orderdelivery/submit_shippment",
type:"POST",
dataType:"json",
contentType:"application/json",
data:JSON.stringify(data),
normalCallback:function(result){
BootstrapDialog.success("發貨成功",function(){
dialog.close();
$dttbltaskorder.draw();
});
}
})
}
}
})
break;
}
});
電話驗證:
data-fv-phone="true" data-fv-phone-country="CN"
支持html5的標籤屬性:參考 http://formvalidation.io/validators/
博客地址:http://www.cnblogs.com/windseek/