Ir para conteúdo

POWERED BY:

Arquivado

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

Hellxande

sobre trabalho com CheckBox

Recommended Posts

Bom dia a todos

 

Depois de procurar em vários Posts relacionados a CkeckBox, infelizmente não consegui encontrar ou entender algo que me auxilia-se, sendo assim resolvi postar a minha situação:

 

Tenho em meu código 1 CkeckBox carregado com os dados de uma Tabela, no caso acabam aparecendo 3 CheckBox com os registros da tabela em modo de execução.

 

Minha dúvida é: Na hora da gravação como saber qual dos Registros do CheckBox's foi selecionado ?

 

Segue o Código para avaliação:

<!--#include file="Conexao.asp" --><%tabCod = Server.CreateObject("adodb.recordset")sql = "SELECT * FROM Destino where DestinoID = "&request.querystring("cod")&""set tabCod = db.execute(sql)%><html><head><title>Documento sem título</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><form name="form1" method="post" action="Def_Cota.asp">  <table width="80%" cellpadding="0">	<tr> 	  <td width="53%" rowspan="2" valign="top"> 		<%		tab2 = Server.CreateObject("adodb.recordset")		sql = "select * from Modalidade"		set tab2 = db.execute(sql)		%>		<table width="100%" cellpadding="0">		  <tr> 			<td><strong>Escolha a Modalidade :</strong></td>		  </tr>		</table>		<% while not tab2.eof %>		<table width="100%" cellpadding="0">		  <tr> 			<td><input type="checkbox" name="checkbox" value="checkbox"> <%=tab2("ModalidadeNome")%></td>		  </tr>		  <%		  tab2.movenext		  wend		  %>		</table>		<br> <br> 		<%		tab3 = Server.CreateObject("adodb.recordset")		sql = "select * from Origem"		set tab3 = db.execute(sql)		%>		<table width="100%" border="0" align="center">		  <tr> 			<td><strong>Selecione a Cidade de Origem :</strong></td>		  </tr>		  <tr> 			<td>			<select name="select" id="select2">			<% while not tab3.eof %>			<option value="<%=tab3("OrigemNome")%>"><%=tab3("OrigemNome")%></option>			<%			tab3.movenext			wend			%>			</select>			</td>		  </tr>		</table>		<br> <br> 		<%		tab4 = Server.CreateObject("adodb.recordset")		sql = "select * from Pessoa"		set tab4 = db.execute(sql)		%>		<table width="100%" border="0" align="center">		  <tr> 			<td><strong>Quantidade de Pessoas : </strong></td>		  </tr>		</table>		<% while not tab4.eof %>		<table width="100%" border="0" align="center">		  <tr> 			<td>			<label> 			  <input name="QtdPessoas" type="text" id="QtdPessoas" size="1" maxlength="3" /><%=tab4("PessoaNome")%>			</label>			</td>		  </tr>		  <%		  tab4.movenext		  wend		  %>		</table>		<br> <br> 		<%		tab5 = Server.CreateObject("adodb.recordset")		sql = "select * from AptoTipo"		set tab5 = db.execute(sql)		%>		<table width="100%" border="0" align="center">		  <tr> 			<td><strong>Tipo de Acomodações : </strong></td>		  </tr>		</table>		<% while not tab5.eof %>		<table width="100%" border="0" align="center">		  <tr> 			<td>			<label> 			  <input name="CheckApto" type="checkbox" id="CheckApto" value="<%=tab5("AptoTipoNome")%>" /><%=tab5("AptoTipoNome")%>			</label>			</td>		  </tr>		  <%		  tab5.movenext		  wend		  %>		</table></td>	  <td width="47%" height="410" valign="top"> 		<%		tab6 = Server.CreateObject("adodb.recordset")		sql = "select * from Hotel"		set tab6 = db.execute(sql)		%>		<table width="100%" border="0" align="center">		  <tr> 			<td width="195"><strong>Hoteis </strong></td>			<td width="89"><strong>Valor</strong></td>		  </tr>		</table>		<% while not tab6.eof %>		<table width="100%" border="0" align="center" id="Hotel">		  <tr> 			<td width="195"><%=tab6("HotelNome")%></td>			<td width="89"> </td>		  </tr>		  <%		  tab6.movenext		  wend		  %>		</table>		<br> <table width="100%" cellpadding="0">		  <tr> 			<td><input name="hiddenField" type="hidden" value="<%=(tabCod.Fields.Item("DestinoNome").Value)%>"></td>		  </tr>		</table></td>	</tr>	<tr>	  <td valign="middle">	  <div align="right"><input type="submit" name="Submit" value="Prosseguir"></div>	  </td>	</tr>  </table></form></body></html>
Desde já agradeço a ajuda de todos.

 

Atenciosamente

 

Hellxande

Compartilhar este post


Link para o post
Compartilhar em outros sites

nesta parte:

<td><input type="checkbox" name="checkbox" value="checkbox"> <%=tab2("ModalidadeNome")%></td>
Você deve atribuir no value o conteudo do recordset e não "checkbox"

para recuperar os dados, veja exemplo neste tópico pendurado de duvidas frequentes do forum Asp

http://forum.imasters.com.br/index.php?sho...amp;#entry89219

Neste exemplo é para excluir, mas você pode adaptar facilmente ao que deseja

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.