/**
 * TextArea校验组件
 * 属性：isNull：是否为空。 当为NO时不可以为空，需要非空校验；当为YES时可以为空，不需要非空校验。
 *       fixLength: 输入固定长度。
 * 说明：1、支持输入固定长度，如果超出固定长度，则禁止输入。
 *       2、支持粘贴，拷贝。
 *
 */

 function TextAreaObj(editerObj){

	//定义输入对象
	this.edtObj = editerObj;


	//公共方法
	this.getParentObj = TAO_getParentObj;
	this.getBaseObj = TAO_getBaseObj;

	this.onvalidate = TAO_onvalidate;

	this.onReady = TAO_onContentReady;
	this.doKeypress = TAO_doKeypress;
 	this.eventBand = TAO_eventBand;


	//私有方法

	//私有对象
    var ParObj=null;
    var BasObj=null;
	}

 	function TAO_getParentObj(){
    	if(this.ParObj==null){
    		this.ParObj = new BaseObj(this.edtObj);
    		}
    		return this.ParObj;
   	}
   function TAO_getBaseObj(){
   	if(this.BasObj==null){
   		this.BasObj = new BaseObj(this.edtObj);
   		}
   	return this.BasObj;
   	}

       function TAO_onvalidate() {
           return this.getBaseObj().commonCheck();
       }


     // Keep user from entering more than maxLength characters
     function TAO_doKeypress(){
     	var maxLength = this.edtObj.getAttribute("maxLength");
     	if(maxLength == null) return true;
     	if(!isNaN(parseInt(maxLength,10))){
     		maxLength = parseInt(maxLength,10);
      	if(this.edtObj.value.length>maxLength)
         	this.edtObj.value=this.edtObj.value.substr(0,maxLength);

     }
   }


     function TAO_onContentReady(){
     	 //调用ParentObj 的初始化方法
    	 this.getParentObj().onReady();
     	}
     function TAO_eventBand(){
     	  this.getBaseObj().eventBand("onkeypress","doKeypress()");
     	}


TextAreaObj.prototype.beforeSubmit = function(){
	this.getParentObj().beforeSubmit();
}
