Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/12/2009, 11:46
spacepecjks
 
Fecha de Ingreso: octubre-2009
Mensajes: 9
Antigüedad: 14 años, 6 meses
Puntos: 0
Por favor Ayuda con mi codigo para enviar variables desde unos combobox

Hola a todos!, soy nuevo en esto de PERl y mas todavía en JavaScript; quisiera me ayudaran con este combo, el cual estoy usando en un archivo de PERL:
El problema es que el combo funciona, solo que al enviar por medio de POST las variables, firstChoice, secondChoice y thirdChoice
al recibirlos en el otro archivo de PERl, quisiera me llegaran lo valores de lo seleccionado en los combos y no la posición del arreglo

Esto me llega de los combos en el archivo de PERL
1 #QUe corresponde al primer valor del primer combo, el cual es firstChoice "Uno"
3 ##QUe corresponde al primer valor del primer combo, el cual es secondChoice, en la parte de arrItems1[3] = "azul";
9 ##QUe corresponde al primer valor del primer combo, el cual es thirdChoice, en la parte de arrItems2[9] = "Phyton";

yo lo que deseo es que me llegue de los combos al otro archivo de PERL es:

Uno # esto del primer combo
AZul # Del segundo Combo
Phyton # Del tercer combo


Espero puedan ayudarme, aquí les dejo mi codigo:
--------------------------------------------------------------------------------

<SCRIPT LANGUAGE="JavaScript">
var arrItems1 = new Array();
var arrItemsGrp1 = new Array();

arrItems1[3] = "azul";
arrItemsGrp1[3] = 1;
arrItems1[4] = "rojo";
arrItemsGrp1[4] = 1;
arrItems1[5] = "verde";
arrItemsGrp1[5] = 1;
arrItems1[6] = "Negro";
arrItemsGrp1[6] = 1;
arrItems1[7] = "Amarillo";
arrItemsGrp1[7] = 1;
arrItems1[8] = "Naranja";
arrItemsGrp1[8] = 1;
arrItems1[9] = "Lila";
arrItemsGrp1[9] = 1;
arrItems1[10] = "Rosa";
arrItemsGrp1[10] = 1;
arrItems1[11] = "Gris";
arrItemsGrp1[11] = 1;
arrItems1[12] = "Escarlata";
arrItemsGrp1[12] = 1;
arrItems1[13] = "PLateado";
arrItemsGrp1[13] = 1;
arrItems1[14] = "Blanco";
arrItemsGrp1[14] = 1;
arrItems1[15] = "Carmesi";
arrItemsGrp1[15] = 2;
arrItems1[16] = "Cafe";
arrItemsGrp1[16] = 2;
arrItems1[17] = "Morado";
arrItemsGrp1[17] = 2;
arrItems1[18] = "Celeste";
arrItemsGrp1[18] = 2;
arrItems1[19] = "Rojo Oxido";
arrItemsGrp1[19] = 2;
arrItems1[20] = "Verde limon";
arrItemsGrp1[20] = 2;

var arrItems2 = new Array();
var arrItemsGrp2 = new Array();

arrItems2[8] = "Perl";
arrItemsGrp2[8] = 3;
arrItems2[9] = "Phyton";
arrItemsGrp2[9] = 3;
arrItems2[10] = "$bar2";
arrItemsGrp2[10] = 3;
arrItems2[11] = "$bar3";
arrItemsGrp2[11] = 3;
arrItems2[12] = "$bar13a";
arrItemsGrp2[12] = 3;
arrItems2[13] = "$bar14a";
arrItemsGrp2[13] = 3;
arrItems2[14] = "$bar15a";
arrItemsGrp2[14] = 3;
arrItems2[15] = "$bar62a";
arrItemsGrp2[15] = 3;

arrItems2[16] = "Uno";
arrItemsGrp2[16] = 4;
arrItems2[17] = "Dos";
arrItemsGrp2[17] = 4;
arrItems2[18] = "Tres";
arrItemsGrp2[18] = 4;
arrItems2[16] = "Cuatro";
arrItemsGrp2[16] = 4;
arrItems2[17] = "Cinco";
arrItemsGrp2[17] = 4;

arrItems2[18] = "URBANA";
arrItemsGrp2[18] = 5;
arrItems2[19] = "RURAL";
arrItemsGrp2[19] = 5;
arrItems2[20] = "CURSOS COMUNITARIOS";
arrItemsGrp2[20] = 5;
arrItems2[21] = "INDIGENA";
arrItemsGrp2[21] = 5;
arrItems2[22] = "PARTICULAR";
arrItemsGrp2[22] = 5;

arrItems2[23] = "URBANA";
arrItemsGrp2[23] = 6;
arrItems2[24] = "RURAL";
arrItemsGrp2[24] = 6;
arrItems2[25] = "CURSOS COMUNITARIOS";
arrItemsGrp2[25] = 6;
arrItems2[26] = "INDIGENA";
arrItemsGrp2[26] = 6;
arrItems2[27] = "PARTICULAR";
arrItemsGrp2[27] = 6;

arrItems2[200] = "PRIVADA";
arrItemsGrp2[200] = 7
arrItems2[201] = "GENERAL";
arrItemsGrp2[201] = 7
arrItems2[203] = "TÉCNICA";
arrItemsGrp2[203] = 7
arrItems2[204] = "TELESECUNDARIA";
arrItemsGrp2[204] = 7
arrItems2[205] = "PARA TRABAJADORES";
arrItemsGrp2[205] = 7


function selectChange(control, controlToPopulate, ItemArray, GroupArray)
{
var myEle ;
var x ;
for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
if (control.name == "firstChoice")
{
for (var q=myChoices.thirdChoice.options.length;q>=0;q--) myChoices.thirdChoice.options[q] = null;
}
myEle = document.createElement("option") ;
myEle.value = 0 ;
myEle.text = "[Selecciona]" ;
controlToPopulate.add(myEle) ;
for ( x = 0 ; x < ItemArray.length ; x++ )
{
if ( GroupArray[x] == control.value )
{
myEle = document.createElement("option") ;
myEle.value = x ;
myEle.text = ItemArray[x] ;
controlToPopulate.add(myEle) ;
}
}
}




function show()
{
var ss= document.getElementById('thirdChoice');
var len= ss.options.length;
var str="";
var j=0;
for(var i=0;i<len;i++){
if(ss.options[i].selected == true)
{
if(j == 0)
str= ss.options[i].innerHTML;
else
str += '|' + ss.options[i].innerHTML;
j++;
}
}
alert(str);
}





</script>

</head>
<body bgcolor = "#CCCCCC" onload="document.myChoices.Nombre.focus()">

<br>
<center><H1>Sistema de Inventario de Servicios, OAM.</H1></center>
<br>

<br>
<Form name="myChoices" Action="localhost/cgi-bin/resultado.pl" method="POST">
<table align="center">
<tr>

</tr><tr>

<td>
<select id=firstChoice name=firstChoice style="width:130px" onchange="selectChange(this, myChoices.secondChoice, arrItems1, arrItemsGrp1);">
<option value=0 selectED>[Selecciona]</option>
<option value=1>Uno</option>
<option value=2>Dos</option>
<option value=3>Tres</option>
<option value=4>Cuatro</option>
<option value=5>Cinco</option>
<option value=6>seis</option>
</select>
</td>
</tr><tr>

<td>
<select id=secondChoice name=secondChoice style="width:130px" onchange="selectChange(this, myChoices.thirdChoice, arrItems2, arrItemsGrp2);">
</select>
</td>
</tr><tr>

<td>
<select id=thirdChoice name=thirdChoice style="width:180px">
</select>
</td>
</tr>
</table>
<hr align="Center" size="2">
<table border="0" align = "Center">
<tr>
<td><input type="Submit" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Continuar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" onclick="show();"></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><input type="reset" value="Borrar Datos">
</tr>
</table>
</form>