Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/06/2013, 02:17
maialenlopez
 
Fecha de Ingreso: abril-2012
Mensajes: 449
Antigüedad: 12 años, 1 mes
Puntos: 7
Que con el evento onchange me carge un combobox

Hola,
Estoy programando en asp, lo que hace el código que escribire mas abajo es que, se escribe un valor dentro del input type=text y cuando le doy al boton me carga un combobox con los resultados de la select.
Código ASP:
Ver original
  1. <html>
  2.     <head>
  3.     </head>
  4.     <body>
  5.         <%
  6.         Set conn = Server.createobject("adodb.connection")
  7.         Set tablabase = Server.createobject("adodb.recordset")
  8.         conn.open "coplan"
  9.         %>
  10.         <table border="5">
  11.             <tr>
  12.                 <td>
  13.                     <form action="referencias_revisiones.asp" method = "post" id="form4" name="buscarPedido">
  14.                         <table border="2" align="center">
  15.                             <tr>
  16.                                 <td align="center" colspan="2">
  17.                                     <u><big><big><strong><tt>REFERENCIAS - REVISIONES</tt></strong></big></big></u>
  18.                                 </td>
  19.                             </tr>
  20.                             <tr>
  21.                                 <td>
  22.                                     Introduce proyecto:
  23.                                     <input type="text" name="pedido" size=20 value="">                     
  24.                                     <input type="submit" name="buscarRevisiones" value="Buscar">
  25.                                 </td>
  26.                                 <td>
  27.                                     <%if request.Form("pedido")<>"" then%>
  28.                                         <%Dim valortext
  29.                                         valortext = request.Form("pedido")%>
  30.                                         <%tablabase.open "select distinct revision from r_coplan where pedido ='"&valortext&"'", conn
  31.                                         Dim i
  32.                                         i = 0%>
  33.                                         <select name="Nombre">                                     
  34.                                             <%while not (tablabase.eof)%>
  35.                                                 <%Session(tablabase("revision")) = tablabase("revision").value
  36.                                                 Dim revision
  37.                                                 revision = tablabase("revision").value
  38.                                                 'response.write revision%>
  39.                                                 <option value="<%=i%>"><%=revision%></option>
  40.                                                 <%i = i+1%>
  41.                                                 <%tablabase.moveNext%>
  42.                                             <%wend%>
  43.                                         </select>
  44.                                         <%tablabase.Close%>
  45.                                     <%end if%>
  46.                                 </td>
  47.                             </tr>
  48.                         </table>
  49.                     </form>
  50.                 </td>
  51.             </tr>
  52.         </table>
  53.         <%Set tablabase = Nothing
  54.         Conn.Close
  55.         Set Conn = Nothing%>
  56.     </body>
  57. </html>

Lo que quiero es quitar el botón y que cuando el input type=text tenga el evento onchange este me cargue lo que cargo al darle al botón en el caso anterior.

He estado mirando y parece ser que hay que utilizar javascript, pero ya que no se utilizarlo no se como obtener el valor del input type=text ni como cargar el combo o poner el código donde hago la select y cargo el combo.

He echo algo así pero ya no se como seguir:
Código ASP:
Ver original
  1. <html>
  2.     <head>
  3.     <SCRIPT>
  4.     <!--
  5.     function CargarCombo() {
  6.         //obtener el valor del input pedido y que me haga lo que hace dentro del if request.form("pedido")
  7.         pedido.focus()
  8.     }
  9.     //-->
  10.     </SCRIPT>
  11.     </head>
  12.     <body>
  13.         <%
  14.         Set conn = Server.createobject("adodb.connection")
  15.         Set tablabase = Server.createobject("adodb.recordset")
  16.         conn.open "coplan"
  17.         %>
  18.         <table border="5">
  19.             <tr>
  20.                 <td>
  21.                     <form action="referencias_revisiones.asp" method = "post" id="form4" name="buscarPedido">
  22.                         <table border="2" align="center">
  23.                             <tr>
  24.                                 <td align="center" colspan="2">
  25.                                     <u><big><big><strong><tt>REFERENCIAS - REVISIONES</tt></strong></big></big></u>
  26.                                 </td>
  27.                             </tr>
  28.                             <tr>
  29.                                 <td>
  30.                                     Introduce proyecto:
  31.                                     <input type="text" name="pedido" size=20 value="" onchange="CargarCombo()">  
  32.                                     <%'<input type="submit" name="buscarRevisiones" value="Buscar">%>
  33.                                 </td>
  34.                                 <td>
  35.                                     <%if request.Form("pedido")<>"" then%>
  36.                                         <%Dim valortext
  37.                                         valortext = request.Form("pedido")
  38.                                         'response.write valortext%>
  39.                                         <%tablabase.open "select distinct revision from r_coplan where pedido ='"&valortext&"'", conn
  40.                                         'response.write "select distinct revision from r_coplan where pedido ='"&valortext&"'"
  41.                                         Dim i
  42.                                         i = 0%>
  43.                                         <select name="Nombre">                                     
  44.                                             <%while not (tablabase.eof)%>
  45.                                                 <%Session(tablabase("revision")) = tablabase("revision").value
  46.                                                 Dim revision
  47.                                                 revision = tablabase("revision").value
  48.                                                 'response.write revision%>
  49.                                                 <option value="<%=i%>"><%=revision%></option>
  50.                                                 <%i = i+1%>
  51.                                                 <%tablabase.moveNext%>
  52.                                             <%wend%>
  53.                                         </select>
  54.                                         <%tablabase.Close%>
  55.                                     <%end if%>
  56.                                 </td>
  57.                             </tr>
  58.                         </table>
  59.                     </form>
  60.                 </td>
  61.             </tr>
  62.         </table>
  63.         <%Set tablabase = Nothing
  64.         Conn.Close
  65.         Set Conn = Nothing%>
  66.     </body>
  67. </html>

¿Alguien me puede echar una mano?
__________________
Gracias por todo;

Un saludo