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

Combo y variable

Estas en el tema de Combo y variable en el foro de ASP Clásico en Foros del Web. Hola amigos : Soy nuevo en esto y tengo el siguiente problema. Quiero que cuando cambie un combo me guarde esto en una variable de ...
  #1 (permalink)  
Antiguo 19/04/2005, 07:19
 
Fecha de Ingreso: marzo-2005
Mensajes: 123
Antigüedad: 19 años, 3 meses
Puntos: 1
Combo y variable

Hola amigos :

Soy nuevo en esto y tengo el siguiente problema.
Quiero que cuando cambie un combo me guarde esto en una variable de tal forma que cuando vuelva a cargar el formulario la variable me permita saber si debo o no mostrar una <table>. Aca esta el codigo....


de antemano gracias

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/ChileCompras.asp" -->


<%
Dim Rst_SolComp
Dim Rst_SolComp_numRows
Dim Rst_M_Proveedores
Dim Rst_M_Proveedores_numRows
Set Rst_SolComp = Server.CreateObject("ADODB.Recordset")
Rst_SolComp.ActiveConnection = MM_ChileCompras_STRING

strSQL = "SELECT * FROM E_SolCompra WHERE SC_Identif=1"
Rst_SolComp.Source = strSQL
Rst_SolComp.CursorType = 0
Rst_SolComp.CursorLocation = 2
Rst_SolComp.LockType = 1
Rst_SolComp.Open ()
Rst_SolComp_numRows = 0
if request("accion")<>"CA" then
if not Rst_SolComp.eof then
xFN_ID = Rst_SolComp("FN_ID")
else
xFN_ID = 0
end if
else
xFN_ID = request("xFN_ID")
end if


Rst_SolComp_numRows = 0
Rst_SolComp.Close()
Set Rst_SolComp = Nothing


Dim Rst_Fondos
Dim Rst_Fondos_numRows
Set Rst_Fondos = Server.CreateObject("ADODB.Recordset")
Rst_Fondos.ActiveConnection = MM_ChileCompras_STRING
Rst_Fondos.Source = "SELECT FN_ID, FN_TIPO FROM M_FONDOS ORDER BY FN_TIPO ASC"
strSQL = "SELECT FN_ID, FN_TIPO FROM M_FONDOS ORDER BY FN_TIPO ASC"
Rst_Fondos.CursorType = 0
Rst_Fondos.CursorLocation = 2
Rst_Fondos.LockType = 1
Rst_Fondos.Open ()
Rst_Fondos_numRows = 0
%>

<html>
<head>
<title>Manejo de combo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name=frm method=post>
<p>
<input type=hidden name=accion value="">
</p>

<% if xFN_ID = 1 then %> <!-- ESTA ES LA VARIABLE QUE ME INTERESA-->
<table width="100%" border="1">
<tr>
<td colspan="7"><div align="center"><strong>DATOS DEL PROVEEDOR</strong></div></td>
</tr>
</table>
<% end if%>

<select name=Combo_Fondos <%= lDisabled %> class=combo onChange="cambiaItem(this)">
<option value="">Seleccione Tipo Fondo</option>
<%
while not Rst_Fondos.eof
sele=""
if ""& xFN_ID = ""&Rst_Fondos("FN_ID") then sele="selected"
response.write("<option "&sele&" value='"&Rst_Fondos("FN_ID") &"' >"&Rst_Fondos("FN_TIPO")&"</option>")
Rst_Fondos.movenext
wend
Rst_Fondos.close%>
</select>
<input name="Sele" type="text" value="<%=xxsele%>" >
</body>
</html>


<script>
function cambiaItem(obj) {
document.frm.action="Combo.asp"
document.frm.accion.value=xFN_ID /*SE QUE ESTA MALO PERO NO SE COMO SE HACE */
document.frm.submit()
}
</script>
  #2 (permalink)  
Antiguo 19/04/2005, 07:55
Avatar de Myakire
Colaborador
 
Fecha de Ingreso: enero-2002
Ubicación: Centro de la república
Mensajes: 8.849
Antigüedad: 22 años, 4 meses
Puntos: 146
No analize tu cñodigo muy bien pero a golpe de vista, tu idea esta bien, pero la estas implementando mal debido a que quieres asignar una valor de servidor en una variable de cliente pero sin indicar esto.

Mas o menos debería ser asi:

<script>
function cambiaItem(obj) {
document.frm.action="Combo.asp"
document.frm.accion.value=<%=xFN_ID %>
document.frm.submit()
}
</script>
  #3 (permalink)  
Antiguo 19/04/2005, 08:45
 
Fecha de Ingreso: marzo-2005
Mensajes: 123
Antigüedad: 19 años, 3 meses
Puntos: 1
me sale un error en onChange="cambiaItem(this)"
en el codigo java me equivoque lo que quiero es algo asi
<script>
function cambiaItem(obj) {
document.frm.action="Combo.asp"
document.frm.xFN_ID = obj.value /*SE QUE ESTA MALO PERO NO SE COMO SE HACE */

document.frm.submit()
}
</script>
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 22:28.