/**
*
*/
$(document).ready(function() {
$.formValidator.initConfig({
theme : "127",
submitOnce : false,
errorFocus : false,
onError : function(msg, obj, errorlist) {
},
ajaxPrompt : '有数据正在异步验证,请稍等...'
});
//身份证验证
$("#idNo").formValidator({
onShowText : "",
onShow : "",
onFocus : "",
onCorrect : "",
onShowFixText : "请输入身份证号码",
defaultValue : ""
}).inputValidator({
min : 1,
max : 18,
onError : "请输入身份证号码"
}).functionValidator({
fun : msg = isCardID ,
onError : msg
});
$("#j_captcha").formValidator({
onShowFixText : "",
onShowText : "",
onShow : "",
onFocus : "",
onCorrect : "",
onShowFixText : "请输入验证码",
defaultValue : ""
}).inputValidator({
min : 1,
max : 200,
onError : "请输入验证码"
});
$("#submitBtn").click(function (e) {
var pageIsValid = $.formValidator.pageIsValid();
if(!pageIsValid){
return;
}
var j_captcha=$("#j_captcha").val();
if(j_captcha.length != 4){
$("#j_captchaTip").html("验证码输入有误,请重新输入!");
$("#j_captchaTip").addClass("onError");
$("#j_captchaTip").show();
return;
}
$.blockUI({message: '
正在查询,请稍候……
'});
Newtouch.Ajax.sendParams({j_captcha:$("#j_captcha").val()}, "../../../jCaptche_check.check", function(data){
if(data['_value']=="ok"){
var idNo= $("#idNo").val();
Newtouch.Direct.postDataWithForm("insuringProgressList.jsp",{idNo:idNo});
}else{
$.unblockUI();
$("#j_captchaTip").html("验证码输入有误,请重新输入!");
$("#j_captchaTip").addClass("onError");
$("#j_captchaTip").show();
refreshCaptcha();
}
}, function(err) {
alert(err);
$.unblockUI();
});
});
});
function closeBlockUI(){
$.unblockUI();
refreshCaptcha();
}
function refreshCaptcha() {
$('#captchaImg').attr('src','../../../images/captchaloadin.gif');
$('#captchaImg').hide().attr('src','../../../res/jcaptcha.jpg' + '?'
+ Math.floor(Math.random() * 100)).fadeIn();
}
function refreshCaptcha2() {
$('#captchaImg2').attr('src','../../../images/captchaloadin.gif');
$('#captchaImg2').hide().attr('src','../../../res/jcaptcha.jpg' + '?'
+ Math.floor(Math.random() * 100)).fadeIn();
}
function checkNumEN(){
var policyNo=$("#policyNo").val();
if(policyNo==""){
return "请输入保单号码";
}
if(/[^A-Za-z0-9]/g.test(policyNo)){
return "保单号码只能输入数字和字母";
}
return true;
}