/**
 * CheckBox校验组件
 * js组件：RadioObj.js
 * 属性：isNullable或nullable：是否为空。 当为false时不可以为空，需要非空校验；当为true时可以为空，不需要非空校验。
 * 说明：1、非空校验
 *      	2、将Enter 键转换为 Tab 键。
 */
 function CheckBoxObj(editerObj){
	var myForm=editerObj.form;
	var strScript="myForm."+editerObj.name;
	//定义输入对象
	this.edtObj = eval(strScript);


	//公共方法
	this.getParentObj = CHBOX_getParentObj;
	this.getBaseObj = CHBOX_getBaseObj;
	this.onvalidate = CHBOX_onvalidate;

	this.onReady = CHBOX_onDocumentReady;
	this.eventBand = CHBOX_eventBand;

	//私有方法

	//私有对象
	var ParObj=null;
	var BasObj=null;
}
function CHBOX_getParentObj(){
	if(this.ParObj==null){
		this.ParObj = new BaseObj(this.edtObj);
	}
	return this.ParObj;
}
function CHBOX_getBaseObj(){
	if(this.BasObj==null){
		this.BasObj = new BaseObj(this.edtObj);
	}
	return this.BasObj;
}

function CHBOX_onvalidate() {
	//调用BaseObject中的公用函数检查数据合法性
/********longhongye**********
* checkBox Obj 无法检查
//	if(!this.getBaseObj().commonCheck()){
//		return false;
//	}
***************************/
	//return true;
	//modify by dongxin 07-9-13 要保留对checkbox非空约束的校验
	return this.getBaseObj().checkEmpty();
}

/**
 *名称：onDocumentReady
 *功能：在select中自动增加这项<option value="">请选择</option>
 *形参：
 *
 *返回：
 */
function CHBOX_onDocumentReady(){
	//调用父类的初始化方法
	this.getParentObj().onReady();
}

function CHBOX_eventBand(){}


CheckBoxObj.prototype.beforeSubmit = function(){
	if(this.edtObj.length){
		for(var i=0; i<this.edtObj.length; i++){
			this.edtObj[i].disabled=false;
		}
	}else{
		this.edtObj.disabled=false;
	}
	this.getParentObj().beforeSubmit();
}
