Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/06/2010, 10:29
RickAR
 
Fecha de Ingreso: junio-2010
Mensajes: 27
Antigüedad: 13 años, 11 meses
Puntos: 0
Llenar campos de combo asp desde javascript

Hola, soy muy novato en JS, disculpen si no me explico bien...

Quiero que uno o mas campos que estan en este formulario hecho con asp se llenen desde otra pagina, con datos que ya vienen desde otra base de datos (esto ultimo no me preocupa).

Lo que necesito es mandar los datos al combo asp de manera automatica sin intervencion del usuario, y que se carguen y se envie el formulario y despues se abra la pagina con los resultados. Espero ser claro...

El combo de form en asp es este que pego abajo. No lo pongo completo porque no entra todo el codigo de la pagina pero espero que este lo necesario... Si no avisenme...
EL CAMPO QUE QUIERO LLENAR, EN PRINCIPIO YA QUE LUEGO QUIZA NECESITE LLENAR OTROS, ESTA CON UN HIGHLIGHT, ES EL CAMPO "FIRMANTE". AQUI VA EL PASTE DEL COMBO ASP, PERDON ES LARGO PERO POR LAS DUDAS LO ENVIO ASI...
--------------paste-----------------------

<html>
<head>

if(document.forms["qryfrm"].ultResultado.value == "media")
{
if (document.all)
{
if (navigator.appName == "Microsoft Internet Explorer")
{
document.all.lblOdAnio.style.visibility = 'hidden'
}
document.all.txtOdAnio.text = ''
}
else if (document.layers)
{
// document.layers[lblPer_Sanc].visibility = "visible"
}

}

else if ((document.forms["qryfrm"].ultResultado.value == "od") || (document.forms["qryfrm"].ultResultado.value == "odsms"))
{
if (document.all)
{
// document.all.lblPer_Sanc.style.visibility = 'hidden'
document.all.lblOdAnio.style.visibility = 'visible'
// document.all.txtPer_sanc.text = ''
document.all.txtOdAnio.text = ''


}
else if (document.layers)
{
// document.layers[lblPer_Sanc].visibility = "hidden"

}
}
else if (document.forms["qryfrm"].ultResultado.value != "od")
{
if (document.all)
{
document.all.lblOdAnio.style.visibility = 'hidden';
document.forms["qryfrm"].txtOdAnio.value = '';
}
else if (document.layers)
document.layers[lblPer_Sanc].visibility = "hidden";
}

}

/************************************************** *********************************/
function algunCampoLleno()
{

var elementos = document.forms["qryfrm"].elements.length;
for (x=10;x<elementos ;x++ )
{
alert(document.forms["qryfrm"].elements[x].name);
}

alert ((document.forms["qryfrm"].tipo_de_proy.value != "") || (document.forms["qryfrm"].proy_expdipN.value != "") ||(document.forms["qryfrm"].proy_expdipA.value != ""));

alert (document.forms["qryfrm"].proy_expdipT.value != "");
alert (document.forms["qryfrm"].firmante.value != "");
alert (document.forms["qryfrm"].selComision.value != "0");
alert (document.forms["qryfrm"].palabras.value != "");
alert (document.forms["qryfrm"].txtOdNum.value != "");
alert (document.forms["qryfrm"].txtODAnio.value != "");
alert (document.forms["qryfrm"].aprobsen.value != "on");
alert (document.forms["qryfrm"].aprobdip.value != "on");
alert (document.forms["qryfrm"].dictdip.value != "on");
alert (document.forms["qryfrm"].dictsen.value != "on");
alert (document.forms["qryfrm"].sancdef.value != "on");
alert (document.forms["qryfrm"].nosancdef.value != "on");
}

function validar(boton)
{


fecha_inicio = document.forms[0].dia_inicio.value + "/" + document.forms[0].mes_inicio.value + "/" + document.forms[0].anio_inicio.value;

fecha_fin = document.forms[0].dia_fin.value + "/" + document.forms[0].mes_fin.value + "/" + document.forms[0].anio_fin.value;
document.forms["qryfrm"].action = "proyectosd.asp"

if(!validar_fecha_desde())
return false;

var txtod = document.getElementById("txtOdAnio")

if (document.forms["qryfrm"].txtODAnio.value.length != 0 && document.forms["qryfrm"].txtODAnio.value.length != 4)
{
alert ("El año de la Orden del Día es inválido")
return false
}

document.forms["qryfrm"].action = document.forms["qryfrm"].action + "?giro_giradoA=" + txtcom + "&odanno=" + document.forms["qryfrm"].txtODAnio.value + "&pageorig=1" + "&fromForm=1&whichpage=1"
;


var txtfecha_inicio = ''
var txtfecha_fin = ''

txtfecha_inicio = document.forms[0].dia_inicio.value + "/" + document.forms[0].mes_inicio.value + "/" + document.forms[0].anio_inicio.value ;
txtfecha_fin = document.forms[0].dia_fin.value + "/" + document.forms[0].mes_fin.value + "/" + document.forms[0].anio_fin.value ;


document.forms["qryfrm"].action = document.forms["qryfrm"].action + "&fecha_inicio=" + txtfecha_inicio + "&fecha_fin=" + txtfecha_fin ;


//document.forms["qryfrm"].action = document.forms["qryfrm"].action + "&fecha_inicio=" + fecha_inicio +"&fecha_fin=" + fecha_fin ;

//alert(document.forms["qryfrm"].action);
document.forms["qryfrm"].submit()
}
function getKeyCode(e)
{

keyPressed = 0;
if (document.all) {
keyPressed = event.keyCode;
} else if (document.layers) {
keyPressed = e.which;
}
else if (document.getElementById)
{
keyPressed = e.keyCode;
}

// if ((keyPressed == 13) && (validar_fecha_desde() && validar_fecha_hasta() )) {
if (keyPressed == 13)
{
if (validar())
document.forms[0].submit();
//document.forms["qryfrm"].id_listar.accept;


} // del if (keyPressed == 13)


} //fin de la funcion
-->
</script>

<SCRIPT TYPE="text/javascript">
<!--
function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
{

return validar(this);
}
else
return true;
}
//-->
</SCRIPT>

</head>

<body bgcolor="#EFEFEF" style="margin-left:0" > <!--onkeydown="getKeyCode(event)"-->
<div class=secparl>XXXXXXXXXXXXXXXXXXXXXX</div>

<div class="form_title">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX</div>
<div style="text-align:center"> <span class="form_option" style="text-align:center">desde el 1º de marzo de 1999 - </span><br>


<div style="text-align:center"> <script>

function OpenWindow(enlace, ancho, alto)
{

window.open(enlace, "ventana_2", "resizable=yes,scrollbars=yes, toolbar=yes, location=no, directories=no, status=YES, menubar=YES, width=" + ancho + ", height=" + alto + ", top=0, left=60");
}
</script>


<span class="autor2"><a id=actualizacion href=javascript:OpenWindow("http://www1.hcdn.gov.ar/proyectos_search/actualizacion.asp?tipo=proyectos",600,440) >Ver datos de actualización</a></span>



<STYLE>
.texto_a{text-decoration:none;font-size:11px;font-family:verdana;font-weight:bold}
a{color:#990066;text-decoration:none;font-size:11px;font-family:verdana;font-weight:bold}
a:hover {text-decoration:underline;color:#666666}
</style> </div>

<form name=qryfrm method=post id=qryfrm onKeyPress="return submitenter(this,event)">
<table border=0 width=90% cellspacing=0 cellpadding=0 align=center>
<tr bgcolor="#EFEFEF"><td colspan="7"><span class="form_title">Datos del proyecto</span></td>
</tr>
<tr>
<td colspan="7">&nbsp;</td>
</tr>
<tr>
<td nowrap><div align="right" class="form_label">Tipo</div></td>
<td><select name=tipo_de_proy id=select2 >
<option value="XXX">XXX
<option value="resolucion">resolución
<option value="declaracion">declaración
<option value="comunicación">comunicación
<option value="resol_decl">resolucion/declaracion
<option value="" selected >todos
</select></td>
</tr>
<tr>
<td><div class="form_label" style=text-align:right>Nro.</div></td>
<td align=left><input name=proy_expdipN type=text id="proy_expdipN" size=5 onBlur=validarExpDipN(this)><span class="form_label"><select name="proy_expdipT" >
<option value="" selected>
<option value="PE">PE
<option value="D">D
<option value="S">S
<option value="CD">CD
<option value="JGM">JGM
<option value="OV">OV
</select></span> <input name="proy_expdipA" type="text" size="4" onBlur=validarExpDipA(this)></div></td>

</tr>
<tr>
<td nowrap><div align="right" class="form_label">Inicio</div></td>
<td><select name=proy_iniciado>
<option value="Baja">Baja
<option value="Alta">Alta
<option value=""></option>
</select></td>
</tr>
<tr>

<tr><td nowrap><div class=form_label>Firmante</div></td>
<td>

Código HTML:
Ver original
  1. <input type=text name=firmante size=40>

</td></tr>

<tr>
<td nowrap><div align="right" class="form_label">Palabras</div></td>
<td colspan="6"><input type=text name="palabras" size=40 ><select name=selSearchOptions>
<option value=and>Todas las palabras</option>
<option value=or>Al menos una palabra</option>
<option value=frase>Frase exacta</option>
</select></td>
</tr>
<tr>
</tr>
</table>
</form>
-----------------FIN PASTE-----------------------

Gracias de antemano y si no se entiende por favor pregunten, soy novato en Javascript y mas en ASP...
Saludos!!!
Rick