以校验客户名是否存在为案例:
this.bIsExist = false; //变量为该类所创健的成员变量用与自动校验
fieldLabel:'客户名称'
,name:'AddForm_sCompellation'
,maxLength:50
,maxLengthText:'客户名称只限于50字以内'
,labelStyle: "text-align: right;"
,width:this.nWideFieldWidth
,validator : this.checkCompellation //"vaidator"为该校验属性,设置校验函数
,invalidText : '此客户名已存在!'
,allowBlank : false
/** * 功能:触发验证客户是否存在函数事件 * * @version 2012/03/27 */ , checkCompellation : function() { //定义变量值 var compellation = this.ownerCt.find('name','AddForm_sCompellation')[0].getValue(); /*-------------- 发送请求----------------*/ Ext.Ajax .request({ url : 'Customer_sameCompellation.do'