/**
* Created by HONGXIN on 2017-10-23.
*/
$(function () {
$('form').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
live: 'disabled',//驗(yàn)證失敗后,提交按鈕仍然是可選狀態(tài)
fields: {
email: {
message: '用戶名驗(yàn)證失敗',//默認(rèn)
verbose: false,
validators: {
notEmpty: {
message: '郵箱不能為空'
},
emailAddress: {
message: '郵箱地址格式有誤'
},
remote: {
url: '/ajax_email',
message:"此郵箱已經(jīng)注冊(cè)",
type: "post",
dataType: 'json',
data: {
//默認(rèn)傳遞的就是輸入框的值
},
delay: 500,//延遲效果
},
}
},
password: {
validators: {
notEmpty: {
message: '郵箱地址不能為空'
},
stringLength: {
min: 6,
max: 18,
message: '用戶名長(zhǎng)度必須在6到18位之間'
},
},
},
password2: {
validators: {
notEmpty: {
message: '確認(rèn)密碼不能為空'
},
identical: {
field: 'password',
message: '兩次密碼必須一致'
}
}
},
username:{
validators: {
notEmpty: {
message: '用戶名不能為空'
},
stringLength: {
min: 2,
max: 8,
message: '用戶名長(zhǎng)度必須在2到8位之間'
}
}
}
}
});
});