..:: MX Studio Fóruns ::..: Marcar varios checkbox - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




ATENÇÃO

Para evitar posts desnecessários e que não influam para o andamento e desenvolvimento do fórum, clique aqui e leia todas as regras.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Marcar varios checkbox

#1 User is offline   igadino 

  • Group: Membros
  • Posts: 65
  • Joined: 10-June 05

Posted 14 March 2010 - 02:40 PM

Pessoal como faço para marcar varios checkbox e depois do reflesh da pagina os checkbox que foram marcado continue marcado, se eu marca so um ele funciona mais se marcar dois ou tres já não funciona

alguém tem uma ideia de como fazer isso.
CÓDIGO
<html>
      <head>
      <title>Untitled Document</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      </head>
      <body>
      <form name="form1" method="post" action="check2.asp">
       <input name="vai" type="checkbox" id="vai" value=".com.br" <% If request("vai")=".com.br"  Then Response.Write("checked")%>>
       <br>
       <input name="vai" type="checkbox" id="vai" value=".com" <% If request("vai")=".com"  Then Response.Write("checked")%>>
       <br>
       <input name="vai" type="checkbox" id="vai" value=".net" <% If request("vai")=".net"  Then Response.Write("checked")%>>
       <br>
       <input name="vai" type="checkbox" id="vai" value=".org" <% If request("vai")=".org"  Then Response.Write("checked")%>>
       <br>
       <input type="submit" name="Submit" value="Submit">
             </form>
      </body>
      </html>

0

#2 User is offline   igadino 

  • Group: Membros
  • Posts: 65
  • Joined: 10-June 05

Posted 14 March 2010 - 03:47 PM

Olha fiz esse for funciona perfeitamente. mais o problema e que os checkbox tem que ter o mesmo nome. os checkbox tem que ser abaixo conforme destacado, porque assim fica melhor para adicionar mais estensões
CÓDIGO
<%
x=split(request("vai"),","
for i=1 to 10
    for i2=lbound(x) to ubound(x)
        if x(i2)=i then
            xx="checked"
        else
            xx=""
   next
%>
       <input name="vai" type="checkbox" id="vai" value="<%=i%>" <%=xx%>>
       <br>
<% next %>


<input name="vai" type="checkbox" id="vai" value=".com.br">
<input name="vai" type="checkbox" id="vai" value=".com">
<input name="vai" type="checkbox" id="vai" value=".org">
<input name="vai" type="checkbox" id="vai" value=".net">

0

#3 User is offline   xanburzum 

  • Group: Administrador
  • Posts: 2076
  • Joined: 04-November 08

Posted 15 March 2010 - 04:54 PM

existe um tópico onde mostro como inserir varios checkbox , dá uma pesquisada no repositório de script

olha esteexemplo:

CÓDIGO
if qtd_produtos = "" then
Response.write("erro..."
response.redirect("outra_pagina.asp")
else
qtd_produtos = split(Request.Form("qtd_produtos"),",")
if qtd_produtos = ""
produtos= Split(Request.Form("produtos"), ",")

For i = 1 To Request.Form("produtos").Count

Response.write request.form("produtos")(i)&"<BR>" & request.form("qtd_produtos")(i)&"<BR>"
SQL = "INSERT INTO lista (lista_prodID,lista_quant) Values ('"&request.form("produtos")(i)&"','"&request.form("qtd_produtos")(i)&"')"

0

#4 User is offline   igadino 

  • Group: Membros
  • Posts: 65
  • Joined: 10-June 05

Posted 15 March 2010 - 10:18 PM

Olha eu conseguir fica para que precisar.
CÓDIGO
<%
response.write "oioio = " & request.form & "<br>"
sVai = split(request.form("dominio"),",")
for i = 0 to ubound(sVai)
sVai(i) = trim(sVai(i))
next
sVai = join(sVai,",")
sVai = "," & replace(sVai,",",",") & ","
%>
<html>
          <head>
          <title>Untitled Document</title>
          <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
          </head>
          <body>
<form name="form1" method="post" action="check2.asp">
<input name="dominio" type="checkbox" id="dominio" value=".com.br" <% If instr(sVai,",.com.br,") > 0  Then Response.Write("checked")%>>.com.br</>
<input name="dominio" type="checkbox" id="dominio" value=".com" <% If instr(sVai,",.com,") > 0  Then Response.Write("checked")%>>.com</>
<input name="dominio" type="checkbox" id="dominio" value=".net" <% If instr(sVai,",.net,") >   Then Response.Write("checked")%>>.net</>
           <input name="dominio" type="checkbox" id="dominio" value=".org" <% If instr(sVai,",.org,") > 0  Then Response.Write("checked")%>>.org</>
           <input name="dominio" type="checkbox" id="dominio" value=".info" <% If instr(sVai,",.info,") > 0  Then Response.Write("checked")%>>.info</>
           <input name="dominio" type="checkbox" id="dominio" value=".name" <% If instr(sVai,",.name,") > 0  Then Response.Write("checked")%>>.name</>
           <input type="submit" name="Submit" value="Submit">
           </form>
          </body>
          </html>

0

#5 User is offline   xanburzum 

  • Group: Administrador
  • Posts: 2076
  • Joined: 04-November 08

Posted 15 March 2010 - 10:46 PM

legal...
parabéns
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)