Defining Global validation functions
Basedev.baseSite.uniqueSiteName=function(field) {if(!field) {return true;}varEditbasesiteinfoform =ext.getcmp (Basedev.baseSite.EDIT_BASE_SITE_FORM_ID);varSiteCode = Editbasesiteinfoform.getform (). FindField ("SiteCode"). GetValue ();varParamsobj ={sitecode:sitecode, Sitename:field, State:editBaseSiteInfoForm.getOperatorType ()};varvalid =false; Ext.Ajax.request ({Url:basedev.realPath (' Uniquecheckbysitename.do '), Params:paramsobj,async:false, Success:function(response) {varresult =Ext.JSON.decode (response.responsetext);if(result.success) {if(Result.data = = 0) {Valid=true;}}Else{Ext.ux.Toast.msg (Prompted, result.msg);}},failure:function(response) {Ext.ux.Toast.msg (' Hint ', response.responsetext, ' ERROR ');}});if(valid) {return true;}return' The store name already exists ';};
Control uses blur instead of validatorlisteners:{' Blur ':function(field) {varUniquesitename =Basedev.baseSite.uniqueSiteName (field.rawvalue);if(uniquesitename!=true) {field.markinvalid (uniquesitename); }}}/***************** The Ajax check when submitting the form start*****************/varUniquesitename=basedev.basesite.uniquesitename (Basesiteform.findfield (' SiteName ')). GetValue ());if(uniquesitename!=true) {Basesiteform.findfield (' SiteName '). Markinvalid (uniquesitename);return;}/***************** The Ajax check when submitting the form end*****************/
EXT Ajax Validator Full form field repeat check processing