Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

salmeida

Selecionar a Categoria e amostrar a Subcategoria

Recommended Posts

não consigo achar o erro ele da erro, ele diz que o arrDL1 não esta definido... o cod abeixo

 

<%Call AbreBancoDim VarActVarAct = Request.QueryString("Act")Dim ConsCategoriaDim ConsCategoria_numRowsDim ConsSubCategoriaDim ConsSubCategoria_numRowsSet ConsCategoria = Server.CreateObject("ADODB.Recordset")ConsCategoria.ActiveConnection = BancoConsCategoria.Source = "Select * From Categorias Order By Categoria"ConsCategoria.CursorType = 0ConsCategoria.CursorLocation = 2ConsCategoria.LockType = 1ConsCategoria.Open()ConsCategoria_numRows = 0Set ConsSubCategoria = Server.CreateObject("ADODB.Recordset")ConsSubCategoria.ActiveConnection = BancoConsSubCategoria.Source = "Select * From SubCategorias Order By SubCategoria"ConsSubCategoria.CursorType = 0ConsSubCategoria.CursorLocation = 2ConsSubCategoria.LockType = 1ConsSubCategoria.Open()ConsSubCategoria_numRows = 0%><script language="JavaScript"><!--var arrDynaList = new Array();var arrDL1 = new Array();arrDL1[1] = "Categoria";arrDL1[2] = "Cadastro";arrDL1[3] = "SubCategoria";arrDL1[4] = "Cadastro";arrDL1[5] = arrDynaList;  <%Dim txtDynaListRelation, txtDynaListLabel, txtDynaListValue, oDynaListRStxtDynaListRelation = "CodCategoria" 	' Name of recordset field relating to parenttxtDynaListLabel = "SubCategoria" 			' Name of recordset field for child Item LabeltxtDynaListValue = "Cod" 			' Name of recordset field for child ValueSet oDynaListRS = ConsSubCategoria						' Name of child list box recordset  Dim varDynaListvarDynaList = -1Dim varMaxWidthvarMaxWidth = "1"Dim varCheckGroupvarCheckGroup = oDynaListRS.Fields.Item(txtDynaListRelation).ValueDim varCheckLengthvarCheckLength = 0Dim varMaxLengthvarMaxLength = 0While (NOT oDynaListRS.EOF) If (varCheckGroup <> oDynaListRS.Fields.Item(txtDynaListRelation).Value) Then  If (varCheckLength > varMaxLength) Then   varMaxLength = varCheckLength  End If  varCheckLength = 0 End If%> arrDynaList[<%=(varDynaList+1)%>] = "<%=(oDynaListRS.Fields.Item(txtDynaListRelation).Value)%>" arrDynaList[<%=(varDynaList+2)%>] = "<%=(oDynaListRS.Fields.Item(txtDynaListLabel).Value)%>" arrDynaList[<%=(varDynaList+3)%>] = "<%=(oDynaListRS.Fields.Item(txtDynaListValue).Value)%>"<% If (len(oDynaListRS.Fields.Item(txtDynaListLabel).Value) > len(varMaxWidth)) Then  varMaxWidth = oDynaListRS.Fields.Item(txtDynaListLabel).Value End If varCheckLength = varCheckLength + 1 varDynaList = varDynaList + 3 oDynaListRS.MoveNext()WendIf (varCheckLength > varMaxLength) Then varMaxLength = varCheckLengthEnd If%>//--></script><script language="JavaScript"><!--function setDynaList(arrDL){ var oList1 = document.forms[arrDL[2]].elements[arrDL[1]]; var oList2 = document.forms[arrDL[4]].elements[arrDL[3]]; var arrList = arrDL[5];  clearDynaList(oList2);  if (oList1.selectedIndex == -1){  oList1.selectedIndex = 0; } populateDynaList(oList2, oList1[oList1.selectedIndex].value, arrList); return true;} function clearDynaList(oList){ for (var i = oList.options.length; i >= 0; i--){  oList.options[i] = null; }  oList.selectedIndex = -1;} function populateDynaList(oList, nIndex, aArray){oList[oList.length]= new Option("Selecione uma sub-categoria"); for (var i = 0; i < aArray.length; i= i + 3){  if (aArray[i] == nIndex){   oList.options[oList.options.length] = new Option(aArray[i + 1], aArray[i + 2]);  } } if (oList.options.length == 1){  oList.options[oList.options.length] = new Option("Nenhuma sub-categoria"); } oList.selectedIndex = 0; }//--></script><!--#include file="../Includes/Form.asp"--><table width="100%" border="0" cellspacing="0" cellpadding="0">  <tr>	<td><!--#include file="../Includes/BarraCimaAdm.asp"--></td>  </tr>  <tr>	<td>		<table width="100%"  border="0" cellspacing="0" cellpadding="0">			  <tr>				<td width="176" height="100%" valign="top"><!--#include file="../Includes/BarraEsqAdm.asp"--></td>				<td width="0" valign="top">					<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">						  <tr>							<td width="100%" height="9%" align="center"><img src="../Imagens/SpacerCima.gif" width="1" height="9"></td>						</tr>		 				<tr>		 				  <td height="20" align="center" bgcolor="<%=FundoTitulo%>"><div align="left"><span class="TextTahoma11AzulBold">  Inserir de Produto</span></div></td>	   				  </tr>		 				<tr>							<td height="19%" align="center"> </td>						  </tr>						  <tr>							<td align="center" valign="middle">						  <%						  If VarAct = "" Then						  							  With Response						  								  .Write "<table>"								.Write "<form action="& Chr(34) &"InsProduto.asp?Act=Cadastrar"& Chr(34) &" method="& Chr(34) &"post"& Chr(34) &" name="& Chr(34) &"Cadastro"& Chr(34) &" enctype="& Chr(34) &"multipart/form-data"& Chr(34) &">"								.Write CamposObrigatorios								.Write LinhaHorizontal2								  .Write "<tr><td><span class="& Chr(34) &"TextTahoma11CinzaBold"& Chr(34) &">Categoria:* </span></td><td>"							End With															%>								<select name="Categoria" onChange="setDynaList(arrDL1)" class="FormCidadeBairroFuncaoCategoriaSubCategoria">					<option selected>Selecione uma categoria</option>					<%										While (NOT ConsCategoria.EOF)										%>					<option value="<%=(ConsCategoria.Fields.Item("Cod").Value)%>"><%=UCase((ConsCategoria.Fields.Item("Categoria").Value))%></option>					  <%										  ConsCategoria.MoveNext()					Wend					If (ConsCategoria.CursorType > 0) Then					  ConsCategoria.MoveFirst					Else					  ConsCategoria.Requery					End If										%>					</select>								<%															With Response								.Write "</td></tr>"								.Write LinhaHorizontal2								  .Write "<tr><td><span class="& Chr(34) &"TextTahoma11CinzaBold"& Chr(34) &">SubCategoria:* </span></td><td><select name=SubCategoria class="& Chr(34) &"FormCidadeBairroFuncaoCategoriaSubCategoria"& Chr(34) &"><option selected>Selecione uma sub-categoria</option>"								.Write "</select></td></tr>"								.Write LinhaHorizontal2								  .Write FCampos(30)								.Write LinhaHorizontal2								  .Write FCampos(21)								.Write LinhaHorizontal2								  .Write FCampos(22)								.Write LinhaHorizontal2								  .Write FCampos(23)								.Write LinhaHorizontal2								  .Write FCampos(24)								.Write LinhaHorizontal2								.Write FCampos(49)								.Write LinhaHorizontal2								.Write FCampos(50)								.Write LinhaHorizontal2								.Write FCampos(25)								.Write LinhaHorizontal2								.Write FCampos(26)								.Write LinhaHorizontal2								.Write FCampos(32)								.Write "</form>"								.Write "</table>"														  End With 						  						  %>						  </td>	   				  </tr>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.