Foros del Web » Programando para Internet » ASP Clásico »

Autoidetectar el campo elegido por el usuario

Estas en el tema de Autoidetectar el campo elegido por el usuario en el foro de ASP Clásico en Foros del Web. Tengo este formulario Código: <form method="GET" action="galeria_james.asp"> <table border="0" width="100%"> <tr> <td width="25%" class="text">Número de imágenes</td> <td width="12%" class="text"><input type="radio" name="tamanopagina" value="18">&nbsp;18</td> <td width="12%" class="text"><input ...
  #1 (permalink)  
Antiguo 03/04/2005, 18:31
Avatar de El_Metallick  
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 22 años, 6 meses
Puntos: 16
Autoidetectar el campo elegido por el usuario

Tengo este formulario
Código:
<form method="GET" action="galeria_james.asp">
<table border="0" width="100%">
  <tr>
    <td width="25%" class="text">Número de imágenes</td>
    <td width="12%" class="text"><input type="radio" name="tamanopagina" value="18">&nbsp;18</td>
    <td width="12%" class="text"><input type="radio" name="tamanopagina" value="24" checked>&nbsp;24</td>
    <td width="12%" class="text"><input type="radio" name="tamanopagina" value="30">&nbsp;30</td>
    <td width="13%" class="text"><input type="radio" name="tamanopagina" value="36">&nbsp;36</td>
    <td width="13%" class="text"><input type="radio" name="tamanopagina" value="42">&nbsp;42</td>
    <td width="13%" class="text"><input type="radio" name="tamanopagina" value="48">&nbsp;48</td>
  </tr>
  <tr>
    <td width="25%" class="text">Tamaño de la imagen</td>
    <td width="12%" class="text"><input type="radio" name="tamanoimg" value="100">&nbsp;100x70</td>
    <td width="12%" class="text"><input type="radio" name="tamanoimg" value="125" checked>&nbsp;125x87</td>
    <td width="12%" class="text"><input type="radio" name="tamanoimg" value="150">&nbsp;150x105</td>
    <td width="13%" class="text"><input type="radio" name="tamanoimg" value="175">&nbsp;175x122</td>
    <td width="13%" class="text"><input type="radio" name="tamanoimg" value="200">&nbsp;200x140</td>
    <td width="13%" class="text" align="center"><input type="submit" value="Ver" name="B1" style="background-color: #333333; color: #CCCCCC; font-weight: bold; font-size: 10 px; border-style: solid; border-color: #CCCCCC"></td>
  </tr>
</table>
</form>
Y lo que quiero hacer es que el checked automaticamente se ponga en el campo que el usuario eligui una vez que el formulario es analizado por la pagina, osea en el fono lo que quiero es que si el usuario elige 48 fotos y de 100x70 estos campos queden seleccionados despues de traducir los resultados, y si eligio 18 fotos y 200x122 queden esos dos campos seleccionados, no se si me explique
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!
  #2 (permalink)  
Antiguo 04/04/2005, 09:28
Avatar de El_Metallick  
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 22 años, 6 meses
Puntos: 16
nadie sabe hacer esto???
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!
  #3 (permalink)  
Antiguo 04/04/2005, 09:41
Avatar de txarly  
Fecha de Ingreso: marzo-2003
Ubicación: Eibar (Gipuzkoa)
Mensajes: 455
Antigüedad: 22 años, 2 meses
Puntos: 2
Podrias utilizar variables de session para almacenar los campos tamanopagina y tamanoimg cada vez que procesas la pagina.
Es decir, cada vez que cargas el formulario preguntarias por esas variables de session y activarias el check correspondiente.

Un saludo
Txarly
__________________
¿Por qué Uri Geller doblaba cucharas?
  #4 (permalink)  
Antiguo 04/04/2005, 11:50
Avatar de El_Metallick  
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 22 años, 6 meses
Puntos: 16
no entendi tu idea puedes poner un ejemplo???
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!
  #5 (permalink)  
Antiguo 04/04/2005, 11:54
Avatar de pablinweb  
Fecha de Ingreso: julio-2003
Mensajes: 283
Antigüedad: 21 años, 9 meses
Puntos: 0
puedes poner la pagina en la que procesas? osea todo el codigo así no tengo que escribirlo todo.
Gracias
  #6 (permalink)  
Antiguo 04/04/2005, 12:17
Avatar de El_Metallick  
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 22 años, 6 meses
Puntos: 16
ahi esta el codigo
Código:
<%@ Language="VBScript" %>
<% Option Explicit %>
<!--#include file="adovbs.inc" -->
<!--#include file="lenguaje.asp" -->
<html>
<head>
<title><% = Titulo %></title>
<!--#include file="meta_tangs.asp" -->
<SCRIPT>
<!--
function displayWindow(url, width, height) 
{
 var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=no,scrollbars=no,menubar=no,status=no' );
}
//-->
</SCRIPT>
<link rel="stylesheet" type="text/css" href="estilo1.css">
</head>
<body>
  <table border="1" bordercolor="<% = ColorBorde %>" width="<% = AnchoTabla %>" cellpadding="0" align="center">
    <tr>
      <td width="15%" bgcolor="<% = ColorFondo3 %>" valign="top" align="center">
        <!--#include file="lateral_i.asp" -->
          <tr>
            <td width="100%" bgcolor="<% = ColorFondo3 %>" valign="top" class="text">&nbsp;</td>
          </tr>
          <tr>
            <td width="100%" bgcolor="<% = ColorFondo3 %>" valign="top" class="text"><a href="galeria_james.asp">Galería de James</a></td>
          </tr>
          <tr>
            <td width="100%" bgcolor="<% = ColorFondo3 %>" valign="top" class="text"><a href="galeria_kirk.asp">Galería de Kirk</a></td>
          </tr>
          <tr>
            <td width="100%" bgcolor="<% = ColorFondo3 %>" valign="top" class="text"><a href="galeria_lars.asp">Galería de Lars</a></td>
          </tr>
          <tr>
            <td width="100%" bgcolor="<% = ColorFondo3 %>" valign="top" class="text"><a href="galeria_jason.asp">Galería de Jason</a></td>
          </tr>
          <tr>
            <td width="100%" bgcolor="<% = ColorFondo3 %>" valign="top" class="text"><a href="galeria_cliff.asp">Galería de Cliff</a></td>
          </tr>
          <tr>
            <td width="100%" bgcolor="<% = ColorFondo3 %>" valign="top" class="text"><a href="galeria_rob.asp">Galería de Rob</a></td>
          </tr>
          <tr>
            <td width="100%" bgcolor="<% = ColorFondo3 %>" valign="top" class="text"><a href="galeria_banda.asp">Galería de la Banda</a></td>
          </tr>
        </table>
      </td>
      <td width="75%" valign="top">
        <p align="center"><font face="Blade Runner Movie Font" color="#ff0000" size="6">Galeria James</font></p>
<%
Dim rs
Dim Conn
Dim sqltxt
Dim tamanopagina
Dim tamanoimg
Dim paginaabsoluta
Dim inicio
Dim fin
Dim contador
Dim j
Dim n
Dim i
Dim atras

Server.ScriptTimeOut=180

tamanoimg=request.querystring("tamanoimg")
tamanopagina=request.querystring("tamanopagina")

if tamanopagina = "" then

tamanopagina=24

end if

paginaabsoluta=request.querystring("paginaabsoluta")

if paginaabsoluta="" then

paginaabsoluta=1

end if

set rs = CreateObject("ADODB.Recordset")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("james.mdb"))

rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic

sqltxt="SELECT * FROM imagenes"

rs.Open sqltxt, conn

if tamanopagina <> "all" then

rs.pagesize= cint(tamanopagina)
rs.absolutepage=cint(paginaabsoluta)
contador=1
%>
<p align="center" class="text">Hay <% = rs.recordcount %> imágenes de James
<br>Estas viendo
<% if tamanopagina="" then %>
24
<% end if %>
<% if tamanopagina="18" then %>
18
<% end if %>
<% if tamanopagina="24" then %>
24
<% end if %>
<% if tamanopagina="30" then %>
30
<% end if %>
<% if tamanopagina="36" then %>
36
<% end if %>
<% if tamanopagina="42" then %>
42
<% end if %>
<% if tamanopagina="48" then %>
48
<% end if %>fotos por página con un tamaño de
<% if tamanoimg="" then %>
150x105
<% end if %>
<% if tamanoimg="100" then %>
100x70
<% end if %>
<% if tamanoimg="125" then %>
125x87
<% end if %>
<% if tamanoimg="150" then %>
150x105
<% end if %>
<% if tamanoimg="175" then %>
175x122
<% end if %>
<% if tamanoimg="200" then %>
200x140
<% end if %>px</p>
<p align="center"><% do while not rs.eof and contador <= cint(tamanopagina) %>
<% if tamanoimg="" then %>
<a href="javascript:displayWindow('img_james.asp?id=<% = RS("ID") %>',<% = RS("Ancho") %>,<% = RS("Alto") %>)"><img src="<% = Img %>/<% = RS("Imagen") %>.<% = RS("Formato") %>" height="150" width="105" border="0" alt="Pulsa para ampliar"></a>
<% end if %>
<% if tamanoimg="100" then %>
<a href="javascript:displayWindow('img_james.asp?id=<% = RS("ID") %>',<% = RS("Ancho") %>,<% = RS("Alto") %>)"><img src="<% = Img %>/<% = RS("Imagen") %>.<% = RS("Formato") %>" height="100" width="70" border="0" alt="Pulsa para ampliar"></a>
<% end if %>
<% if tamanoimg="125" then %>
<a href="javascript:displayWindow('img_james.asp?id=<% = RS("ID") %>',<% = RS("Ancho") %>,<% = RS("Alto") %>)"><img src="<% = Img %>/<% = RS("Imagen") %>.<% = RS("Formato") %>" height="125" width="87" border="0" alt="Pulsa para ampliar"></a>
<% end if %>
<% if tamanoimg="150" then %>
<a href="javascript:displayWindow('img_james.asp?id=<% = RS("ID") %>',<% = RS("Ancho") %>,<% = RS("Alto") %>)"><img src="<% = Img %>/<% = RS("Imagen") %>.<% = RS("Formato") %>" height="150" width="105" border="0" alt="Pulsa para ampliar"></a>
<% end if %>
<% if tamanoimg="175" then %>
<a href="javascript:displayWindow('img_james.asp?id=<% = RS("ID") %>',<% = RS("Ancho") %>,<% = RS("Alto") %>)"><img src="<% = Img %>/<% = RS("Imagen") %>.<% = RS("Formato") %>" height="175" width="122" border="0" alt="Pulsa para ampliar"></a>
<% end if %>
<% if tamanoimg="200" then %>
<a href="javascript:displayWindow('img_james.asp?id=<% = RS("ID") %>',<% = RS("Ancho") %>,<% = RS("Alto") %>)"><img src="<% = Img %>/<% = RS("Imagen") %>.<% = RS("Formato") %>" height="200" width="140" border="0" alt="Pulsa para ampliar"></a>
<% end if %>
<%
rs.movenext

contador=contador+1

loop
%> 
</p>
<div align="center" class="text">Galería: </div><table align="center">
 <tr>

<%j=0

if cint(paginaabsoluta) <> 1 then

atras=cint(paginaabsoluta)-1

response.write "<td align=""center""><a href=""galeria_james.asp?tamanopagina="&tamanopagina&"&paginaabsoluta=" & atras & """>"&"&lt;&lt;"&"</a></td>"

j=j+1

end if

for i = 1 to rs.pagecount

j=j+1

if j>30 then

response.write "</tr><tr>"

j=1

end if 

if cint(i) = cint(paginaabsoluta) then

response.write "<td align=""center"" class=""text"">"&i&"</td>"

else

response.write "<td align=""center""><a href=""galeria_james.asp?tamanopagina="&tamanopagina&"&paginaabsoluta=" & i & """>"&i&"</a></td>"

end if

next

end if
%>
<%
if cint(paginaabsoluta) <> rs.pagecount then

atras=cint(paginaabsoluta)+1

response.write "<td align=""center""><a href=""galeria_james.asp?tamanopagina="&tamanopagina&"&paginaabsoluta=" & atras & """>"&"&gt;&gt;"&"</a></td>"

end if
%>
 </tr>
</table>
<form method="GET" action="galeria_james.asp">
<table border="0" width="100%">
  <tr>
    <td width="25%" class="text">Número de imágenes</td>
    <td width="12%" class="text"><input type="radio" name="tamanopagina" value="18">&nbsp;18</td>
    <td width="12%" class="text"><input type="radio" name="tamanopagina" value="24" checked>&nbsp;24</td>
    <td width="12%" class="text"><input type="radio" name="tamanopagina" value="30">&nbsp;30</td>
    <td width="13%" class="text"><input type="radio" name="tamanopagina" value="36">&nbsp;36</td>
    <td width="13%" class="text"><input type="radio" name="tamanopagina" value="42">&nbsp;42</td>
    <td width="13%" class="text"><input type="radio" name="tamanopagina" value="48">&nbsp;48</td>
  </tr>
  <tr>
    <td width="25%" class="text">Tamaño de la imagen</td>
    <td width="12%" class="text"><input type="radio" name="tamanoimg" value="100">&nbsp;100x70</td>
    <td width="12%" class="text"><input type="radio" name="tamanoimg" value="125">&nbsp;125x87</td>
    <td width="12%" class="text"><input type="radio" name="tamanoimg" value="150" checked>&nbsp;150x105</td>
    <td width="13%" class="text"><input type="radio" name="tamanoimg" value="175">&nbsp;175x122</td>
    <td width="13%" class="text"><input type="radio" name="tamanoimg" value="200">&nbsp;200x140</td>
    <td width="13%" class="text" align="center"><input type="submit" value="Ver" name="B1" style="background-color: #333333; color: #CCCCCC; font-weight: bold; font-size: 10 px; border-style: solid; border-color: #CCCCCC"></td>
  </tr>
</table>
</form>
<br>
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <td width="100%" align="center"><span class="text"><% = Pie %><p><% = Derechos %></p></span></td>
            </tr>
          </table>
      </td>
      <!--#include file="lateral_d.asp" -->
    </tr>
  </table>
</body>
</html>
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!
  #7 (permalink)  
Antiguo 04/04/2005, 12:29
Avatar de pablinweb  
Fecha de Ingreso: julio-2003
Mensajes: 283
Antigüedad: 21 años, 9 meses
Puntos: 0
Prueba con esto:
Código:
<table border="0" width="100%">
  <tr>
    <td width="25%" class="text">Número de imágenes</td>
    <td width="12%" class="text"><input type="radio" name="tamanopagina" value="18" <% if tamanopagina = "18" then response.Write("checked")%>>&nbsp;18</td>
    <td width="12%" class="text"><input type="radio" name="tamanopagina" value="24" <% if tamanopagina = "24" then response.Write("checked")%><% if tamanopagina = "" then response.Write("checked")%>>&nbsp;24</td>
    <td width="12%" class="text"><input type="radio" name="tamanopagina" value="30" <% if tamanopagina = "30" then response.Write("checked")%>>&nbsp;30</td>
    <td width="13%" class="text"><input type="radio" name="tamanopagina" value="36" <% if tamanopagina = "36" then response.Write("checked")%>>&nbsp;36</td>
    <td width="13%" class="text"><input type="radio" name="tamanopagina" value="42" <% if tamanopagina = "42" then response.Write("checked")%>>&nbsp;42</td>
    <td width="13%" class="text"><input type="radio" name="tamanopagina" value="48" <% if tamanopagina = "48" then response.Write("checked")%>>&nbsp;48</td>
  </tr>
  <tr>
    <td width="25%" class="text">Tamaño de la imagen</td>
    <td width="12%" class="text"><input type="radio" name="tamanoimg" value="100" <% if tamanoimg = "100" then response.Write("checked")%>>&nbsp;100x70</td>
    <td width="12%" class="text"><input type="radio" name="tamanoimg" value="125" <% if tamanoimg = "125" then response.Write("checked")%>>&nbsp;125x87</td>
    <td width="12%" class="text"><input type="radio" name="tamanoimg" value="150" <% if tamanoimg = "150" then response.Write("checked")%><% if tamanoimg = "" then response.Write("checked")%>>&nbsp;150x105</td>
    <td width="13%" class="text"><input type="radio" name="tamanoimg" value="175" <% if tamanoimg = "175" then response.Write("checked")%>>&nbsp;175x122</td>
    <td width="13%" class="text"><input type="radio" name="tamanoimg" value="200" <% if tamanoimg = "200" then response.Write("checked")%>>&nbsp;200x140</td>
    <td width="13%" class="text" align="center"><input type="submit" value="Ver" name="B1" style="background-color: #333333; color: #CCCCCC; font-weight: bold; font-size: 10 px; border-style: solid; border-color: #CCCCCC"></td>
  </tr>
</table>
  #8 (permalink)  
Antiguo 04/04/2005, 17:52
Avatar de El_Metallick  
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 22 años, 6 meses
Puntos: 16
ahi si me funciona muchas gracias pablinweb
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:16.