//v.2.6 build 100722
/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
dhtmlxValidation=function(){};dhtmlxValidation.prototype={trackInput:function(el,rule,callback_error,callback_correct){dhtmlxEvent(el,"keyup",function(e){if (!dhtmlxValidation.checkInput(el,rule)){if(!callback_error || callback_error(el,el.value,rule))
el.className+=" dhtmlx_live_validation_error";}else {el.className=el.className.replace(/[ ]*dhtmlx_live_validation_error/g,"");if (callback_correct)callback_correct(el,el.value,rule);}});},
checkInput:function(input,rule){return this.checkValue(input.value,rule);},
checkValue:function(value,rule){if (!rule)return;if (typeof rule!="string" && rule.length){var final_res=true;for (var i=0;i1)this._validators._live=live;if (!this._validators._event)this._validators._event=this.attachEvent("onEditCell",this.validationEvent);};dhtmlXGridObject.prototype.setColValidators=function(vals){if (!this._validators)this.enableValidation(true);if (typeof vals == "string")vals=vals.split(this.delim)
this._validators.data=vals;};dhtmlXGridObject.prototype.validationEvent=function(stage,id,ind,newval,oldval){var v=this._validators;if (!v)return true;var rule=(v.data[ind]||this.cells(id,ind).getAttribute("validate"))||"";if (stage==1 && rule){var ed = this.editor||this._fake.editor;ed.cell.className=ed.cell.className.replace(/[ ]*dhtmlx_validation_error/g,"");if (v._live){var grid=this;dhtmlxValidation.trackInput(ed.getInput(),rule,function(element,value,rule){return grid.callEvent("onLiveValidationError",[id,ind,value,element,rule]);},function(element,value,rule){return grid.callEvent("onLiveValidationCorrect",[id,ind,value,element,rule]);});}};if (stage==2)this.validateCell(id,ind,rule,newval)
return true;};dhtmlXGridObject.prototype.validateCell=function(id,ind,rule,value){rule=rule||(this._validators.data[ind]||this.cells(id,ind).getAttribute("validate"));value=value||this.cells(id,ind).getValue();if (!rule)return;var cell = this.cells(id,ind).cell;if (!dhtmlxValidation.checkValue(value,rule.split(","))){if (this.callEvent("onValidationError",[id,ind,value,rule])){cell.className+=" dhtmlx_validation_error";};return false;}else {this.callEvent("onValidationCorrect",[id,ind,value,rule]);cell.className=cell.className.replace(/[ ]*dhtmlx_validation_error/g,"");};return true;}
//v.2.6 build 100722
/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/