<html>
<head>
<meta http-equiv=content-language content=zh-cn>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<style>
 td {padding:2px 0px 2px 0px;}
 .classtd { padding:2px 5px 2px 5px;}
</style>
<link href="../CSS/Base.css" rel=stylesheet>
<LINK href="../CSS/Window.css" type=text/css rel=stylesheet>
<script type="text/javascript" src="../JS/Common.js.php"></script>
<script type="text/javascript" src="../JS/Window.js.php"></script>
<script language=javascript src="../JS/Textarea.js.php"></script>
<script language=javascript src="../JS/HighLight.js.php"></script>
<script language=javascript src="../JS/CheckQuestion.js.php"></script>
<script type="text/javascript" src="../JS/TableRows.js.php"></script>
<script language=javascript>
var editTextRange;
function Check_Form_Validator()
{
	if (!CheckNotNull(Check_Form.questionName, "题目文字")) {return false;}
	if ( Trim(document.Check_Form.elements[2].value) == "" ) 
	{
		 alert('请至少选择输入一个组合问题!');
		 document.Check_Form.elements[2].focus();
		 return false;
	}
	var theLength = document.getElementById('theOptionTable').rows.length;
	for( i=0;i<theLength;i++)
	{
		var j = i+1;
		var theOptionID = eval("document.getElementById('optionID_" + j +"')");
		var theOptionSize = eval("document.getElementById('optionSize_" + j +"')");
		var theIsCheckType = eval("document.Check_Form.isCheckType_" + j +"");
		var theMinOption = eval("document.getElementById(\"minOption_" + j + "\")");
		var theMaxOption = eval("document.getElementById(\"maxOption_" + j + "\")");

        if( theOptionID != null )
		{
			if( Trim(theOptionID.value) != "" )
			{
				if (!CheckNotNull(theOptionSize, "文本输入框长度")) {return false;}
				if (!CheckNumber(theOptionSize, "文本输入框长度",2,80)) {return false;}
			}

			switch( theIsCheckType.value )
			{
			   case '0':
			   case '1':
			   case '3':
			   case '5':
			   case '6':
			   case '7':
			   case '8':
			   case '9':
			   case '10':
			   break;
			   case '2':
			   case '4':
					if (!CheckNotNull(theMinOption, "要求的输入最少值")) {return false;}
					if (!CheckNotNull(theMaxOption, "要求的输入最多值")) {return false;}
					if (!CheckMinMaxNum(theMinOption, "要求的输入最少值")) {return false;}
					if (!CheckMinMaxNum(theMaxOption, "要求的输入最多值")) {return false;}
					if (Number( theMaxOption.value ) < Number(theMinOption.value) )
					{
						alert('区间值的最多值必须大于最少值');
						theMaxOption.focus();
						return false;
					}
			   break;
			}
		}
	}
}
function checkIsCheckType(value,optionOrderID)
{
   var theMinOption = eval("document.getElementById(\"minOption_" + optionOrderID + "\")");
   var theMaxOption = eval("document.getElementById(\"maxOption_" + optionOrderID + "\")");
   var theCheckInfo = eval("document.getElementById(\"checkInfo_" + optionOrderID + "\")");
   switch( value )
   {
		case '0':
		case '1':
		case '3':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
		case '10':
		   theMinOption.disabled  = true
		   theMaxOption.disabled  = true
		   theCheckInfo.innerHTML= '';
		break;
		case '2':
		   theMinOption.disabled  = false
		   theMaxOption.disabled  = false
		   theCheckInfo.innerHTML= '';
		break;
		case '4':
		   theMinOption.disabled  = false
		   theMaxOption.disabled  = false
		   theCheckInfo.innerHTML= '';
		break;
   }
}
//检查输入内容是否为数字
function CheckMinMaxNum(objField, strText) {
  if (objField.value == "") return true;
  var RE = new RegExp("[^0-9]");
  if (objField.value.search(RE) != -1) {
    alert("“" + strText + "”中只能填写整数！");
    objField.focus();
    return false;
  }
  return true;
}

function Init()
{
	var theLength = document.getElementById('theOptionTable').rows.length;
	var theIsCheckType = eval("document.getElementById(\"isCheckType_" + 1 + "\")");
	for( i=0;i<theLength;i++)
	{
		var m = i+1;
		var theIsCheckType = eval("document.getElementById(\"isCheckType_" + m + "\")");
		checkIsCheckType(getSelectValue(theIsCheckType),m);
	}
}
function getSelectValue(objField)
{
	if( objField != null ) {
		for( k=0;k<objField.options.length;k++ ) 
		{   
			if(objField.options[k].selected)
			{
				return objField.options[k].value;
			}
		}
	}
}
</script>

<meta content="mshtml 6.00.3790.0" name=generator></head>
<body oncontextmenu="return false" onload="javascript:Init();" style="margin-top:0px">
  <table class=datatable style="line-height: 150%;border-collapse:collapse;" cellspacing=0 cellpadding=0 bordercolor=#b5cfd9 border=1 width=100%>
   <div class=position>位置：&nbsp; 我的问卷 &raquo; 编辑问卷问题 &raquo; 组合填空题</div>
   <tr><td colspan="2" bgcolor="#e9e9e9" class=classtd><b>编辑问卷问题</b></td></tr>
   <form method="post" action="" name="Check_Form" onsubmit="return Check_Form_Validator()">
   <tr><td class=classtd>&nbsp;<span style="font-size:14px;font-weight:bold;">组合填空题</span>&nbsp;
     <a onmouseover="this.T_WIDTH=446;this.T_PADDING=0;this.T_BGCOLOR='#ffffff'; return escape('<img src=../Images/Example/example_combtext.jpg width=446 align=center>')" href="javascript:void(0);"><font color=red>图例</font></a></td></tr>
   <tr bgcolor="#f5f5f5" height=25><td class=classtd><b>&nbsp;关于...</b>&nbsp;<img src="../Images/info.gif" border=0></td></tr>
   <tr><td class=classtd>&nbsp;组合填空题指一组填空题的集合，一般应用于组合多个相似性的开放问题。</td></tr>
   <tr bgcolor="#f5f5f5" height=25><td class=classtd><b>&nbsp;题目文字</b>&nbsp;<img src="../Images/info.gif" border=0>
     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="javascript:{var textEditor = document.getElementById('questionName');textEditor.focus();editTextRange = textEditor.document.selection.createRange();showPopWin('ShowInsertImage.php', 590, 260, null, null,'插入图片或视频');}"><font color=red><b>插入图片或视频</font></b></a><img src="../Images/list_menu_arrow.gif" border=0>
   </td></tr>
   <tr><td class=classtd><textarea rows=5 cols=128 name="questionName" id="questionName" tabIndex=1>{questionName}</textarea>  <a href="javascript:resizeTextHeight('questionName',1);"><img src="../Images/jia.gif"></a><a href="javascript:resizeTextHeight('questionName',-1);"><img src="../Images/jian.gif"></a></td></tr>
   <tr bgcolor="#f5f5f5" height=25><td class=classtd>&nbsp;有关问题的说明或问题回复提示&nbsp;<img src="../Images/info.gif" border=0></td></tr>
   <tr><td class=classtd><textarea rows=3 cols=128 name="questionNotes" id="questionNotes" tabIndex=1>{questionNotes}</textarea>  <a href="javascript:resizeTextHeight('questionNotes',1);"><img src="../Images/jia.gif"></a><a href="javascript:resizeTextHeight('questionNotes',-1);"><img src="../Images/jian.gif"></a></td></tr>
   <tr bgcolor="#f5f5f5" height=25><td class=classtd><b>&nbsp;组合问题</b>&nbsp;<img src="../Images/info.gif" border=0></td></tr>
   <tr><td class=classtd>
    <table id="theOptionTable" style="LINE-HEIGHT: 150%;border-collapse:collapse;" cellSpacing=0 cellPadding=0 width="100%" borderColor=#999999 border=1>
	 <tr bgcolor="#cccccc">
	     <td width=4% nowrap>&nbsp;<a href="javascript:void(0)" onclick="insertCombTextRow(document.getElementById('theOptionTable').rows.length)" title="增加组合问题"><img src="../Images/jia.gif" border=0></a>&nbsp;<a href="javascript:void(0)" onclick="deleteCombTextRow()" title="减少组合问题"><img src="../Images/jian.gif" border=0></a></td>
	     <td width=28%>&nbsp;<b>组合问题文字</b>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="javascript:showPopWin('ShowBatchOption.php?isRange=1', 570, 290, null, null,'批量增加问题');"><font color=red><b>批量增加问题</font></b></a></td>
		 <td width=7%>&nbsp;<b>长度</b></td>
		 <td width=6%>&nbsp;<b>必答</b></td>
		 <td width=54%>&nbsp;<b>输入检查规则</td></tr>
	 <!-- BEGIN OPTION -->
	 <tr><td align=center>&nbsp;{optionOrderID}：</td>
	     <td>&nbsp;<input size=30 name="optionID[{optionOrderID}]" id="optionID_{optionOrderID}" value="{optionName}">&nbsp;</td>
		 <td>&nbsp;<input size=2 name="optionSize[{optionOrderID}]" id="optionSize_{optionOrderID}" value="{optionSize}"></td>
		 <td>&nbsp;<input type="checkbox" value="1" name="isRequired[{optionOrderID}]" id="isRequired_{optionOrderID}" {isRequired}></td>
		 <td>&nbsp;<select name="isCheckType_{optionOrderID}" id="isCheckType_{optionOrderID}" onchange="checkIsCheckType(document.Check_Form.isCheckType_{optionOrderID}.options[document.Check_Form.isCheckType_{optionOrderID}.selectedIndex].value,{optionOrderID});">
		     <option value="0" {isCheckType0_{optionOrderID}}>请选择输入检查规则</option>
		     <option value="1" {isCheckType1_{optionOrderID}}>检查输入为Email</option>
		     <option value="2" {isCheckType2_{optionOrderID}}>检查字符串长度</option>
		     <option value="3" {isCheckType3_{optionOrderID}}>禁止字符串出现中文</option>
		     <option value="4" {isCheckType4_{optionOrderID}}>检查输入为数值</option>
		     <option value="5" {isCheckType5_{optionOrderID}}>检查输入为电话号码</option>
		     <option value="6" {isCheckType6_{optionOrderID}}>检查输入为日期</option>
		     <option value="7" {isCheckType7_{optionOrderID}}>检查输入为身份证号</option>
		     <option value="8" {isCheckType8_{optionOrderID}}>检查输入为企业法人代码</option>
		     <option value="9" {isCheckType9_{optionOrderID}}>检查输入为邮政编码</option>
		     <option value="10" {isCheckType10_{optionOrderID}}>检查输入为网址</option>
		    </select>&nbsp;&nbsp;<span id=checkInfo_{optionOrderID}>区间值：</span>最少：<input name="minOption[{optionOrderID}]" id="minOption_{optionOrderID}" type="text" size=4 value="{minOption}">&nbsp;最多：<input name="maxOption[{optionOrderID}]" type="text" size=4  id="maxOption_{optionOrderID}"  value="{maxOption}"></td>
	 </tr>
	 <!-- END OPTION -->
     </table></td>
   </tr>
   </tr></table><table width=100%>
   <tr> 
  	 <td height="15" class=classtd>
         <input name="surveyID" type="hidden" id="surveyID" value="{surveyID}"> 
         <input name="questionID" type="hidden" id="questionID" value="{questionID}"> 
         <input name="orderByID" type="hidden" id="orderByID" value="{orderByID}"> 
         <input class=inputsubmit name="AddCombTextSubmit" type=submit id="AddCombTextSubmit" value="保存，下一个"> 
         <input class=inputsubmit name="AddCombTextOver" type=submit id="AddCombTextOver" value="保存，结束"> 
         <input class=inputsubmit type="button" name="close" value="  关闭  " onClick="javascript:parent.hidePopWin();">
      </td>
    </tr>
  </form>
 </table>
  <script type="text/javascript">initInputHighlightScript();</script> 
  <script language=javascript src="../JS/Example.js.php"></script>
</body></html>
