`

.bootstrapValidator 密码格式及等值验证

 
阅读更多
function formValidator() {
	$("#edit_form").bootstrapValidator({
		// message: 'This value is not valid',
		feedbackIcons : {
			valid : 'glyphicon glyphicon-ok',
			invalid : 'glyphicon glyphicon-remove',
			validating : 'glyphicon glyphicon-refresh'
		},
		fields : {
			password : {
				validators : {
					notEmpty : {
						message : '请输入原密码!'
					},
					remote : {
						type : "post",
						url : webBasePath + "user/vpassword",
						data : function(validator) {
							return {
								password : $("#password").val()
							};
						},
						message : '原密码,输入错误请核对后重新输入!',
					}
				}
			},
			newpassword : {
				validators : {
					notEmpty : {
						message : '请输入新密码!'

					},
					regexp : {
						regexp : /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/,
						message : '密码由6-21字母和数字组成,不能是纯数字或纯英文!'
					}
				}
			},
			renewpassword : {
				validators : {
					notEmpty : {
						message : '请再次输入新密码!',
						equalTo : "#newpassword"
					},
					identical : {
						field : 'newpassword',
						message : '两次填写的密码不一致!'
					}

				}
			}
		}
	});
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics