easyui textbox會經常用到validatebox驗證,驗證不通過form無法提交,這個在我的另一篇博客中有解答http://blog.csdn.net/linadadan/article/details/71304757,而這次的遇到的要求是驗證完只是提示,可以繼續操作,於是就想到了easyui textbox的失去焦點事件 ,找了一些資料找到解答辦法。
代碼:
<div class="label">來文字號</div>
<div class="content">
<input name="C_COMEDOCNUM" id="C_COMEDOCNUM" class="easyui-textbox" data-options="fit:true,required:true" />
</div>
jquery代碼:
$("input",$("#C_COMEDOCNUM").next("span")).blur(function(){
var data = {
id: $('#C_ID').val(),
C_COMEDOCNUM:$('#C_COMEDOCNUM').textbox('getValue')
};
var result = false;
$.ajax({
url : 'table/T_REG_RECIVE/unique.action',
async : false,
type : "POST",
data : data,
success : function(flag) {
result = flag == 'true';
}
});
if(!result){
$.messager.show({
title : '提示',
msg : '來文字號已經存在',
timeout:1000,
showType:'slide'
});
}
});