
21/12/2005, 16:47
|
| | Fecha de Ingreso: agosto-2003
Mensajes: 3
Antigüedad: 21 años, 7 meses Puntos: 0 | |
Validacion De Campo Select Tengan todos buenas tardes
Quisiera saber si me pueden ayudar con la validacion de un campo select en el cual el nombre del campo es un arreglo :
<select name="atri_pos[]">
......
</select>
Es que lo que quiero hacer es que yo hare una seleccion multiple de un listado y lo enviare al campo del select anterior para que luego sea procesado y si el usuario no selecciona nada del primer select entonces deberia de enviarle el error.
Este es el codigo q estoy ocupando para realizarlo
<script language="JavaScript">
function move(fbox, tbox, myId)
{
//muestra el boton
show('myId');
hide('myIduno');
//fin de mostrar boton
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for(i=0; i<tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length //obtiene el tamaño de el arreglo
for(i=0; i<fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if(fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
} else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
}
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c=0; c<arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c=0; c<arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
}
}
function selectAll(box)
{
for(var i=0; i<box.length; i++)
{
box.options[i].selected = true;
}
}
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" rowspan="3">
<select name="atri_pos[]" size="20" style="width:150; color: black; background-color: #EEEEEE; font-size: 10px; font-family: Verdana, Tahoma, Arial" multiple>
<option value="uno">1</option>
<option value="uno">2</option>
<option value="uno">3</option>
<option value="uno">4</option>
<option value="uno">5</option>
</select>
</td>
<td height="33" valign="top" align="center">
<input type="button" name="Submit4" value=">>" onClick="move(this.form.elements['atri_pos[]'],this.form.elements['atri_deseado[]'],'myId')">
</td>
<td rowspan="3" valign="top">
<select name="atri_deseado[]" size="20" style="width:150; background-color: #EEEEEE; color: black; font-size: 10px; font-family: Verdana, Tahoma, Arial" multiple>
</select>
</td>
</tr>
<tr>
<td height="33" valign="top" align="center">
<input type="button" name="Submit3" value="<<" onClick="move(this.form.elements['atri_deseado[]'],this.form.elements['atri_pos[]'])">
</td>
</tr>
<tr>
<td height="11"></td>
</tr>
</table>
De antemano gracias por su ayuda |