Foros del Web » Programando para Internet » Javascript »

no puedo enviar por formulario una lista creada mediante javascript

Estas en el tema de no puedo enviar por formulario una lista creada mediante javascript en el foro de Javascript en Foros del Web. Buenas, mi duda es la siguiente: Hago que a partir de una lista apretando la opcion que quieras te la ponga en la otra lista ...
  #1 (permalink)  
Antiguo 18/01/2005, 13:12
 
Fecha de Ingreso: noviembre-2003
Mensajes: 22
Antigüedad: 20 años, 5 meses
Puntos: 0
no puedo enviar por formulario una lista creada mediante javascript

Buenas, mi duda es la siguiente: Hago que a partir de una lista apretando la opcion que quieras te la ponga en la otra lista pero luego cuando apreto enviar el formulario no me lo pasa, alguien sabe como puedo hacer para que me pase todos los options que he introducido en la lista de "choiceBox"???

Os dejo todo el codigo aki...

Cita:
<html>
<head>
<title>Selecciona elementos en lista 2</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Kathi O'Shea (Kathi.O'[email protected]) -->
<!-- Web Site: http://www.web-savant.com/users/kathi/asp -->


<!-- Begin
function moveOver()
{
var boxLength = document.choiceForm.choiceBox.length;
var selectedItem = document.choiceForm.available.selectedIndex;
var selectedText = document.choiceForm.available.options[selectedItem].text;
var selectedValue = document.choiceForm.available.options[selectedItem].value;
var i;
var isNew = true;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
thisitem = document.choiceForm.choiceBox.options[i].text;
if (thisitem == selectedText) {
isNew = false;
break;
}
}
}
if (isNew) {
newoption = new Option(selectedText, selectedValue, false, false);
document.choiceForm.choiceBox.options[boxLength] = newoption;
}
document.choiceForm.available.selectedIndex=-1;
}
function removeMe() {
var boxLength = document.choiceForm.choiceBox.length;
arrSelected = new Array();
var count = 0;
for (i = 0; i < boxLength; i++) {
if (document.choiceForm.choiceBox.options[i].selected) {
arrSelected[count] = document.choiceForm.choiceBox.options[i].value;
}
count++;
}
var x;
for (i = 0; i < boxLength; i++) {
for (x = 0; x < arrSelected.length; x++) {
if (document.choiceForm.choiceBox.options[i].value == arrSelected[x]) {
document.choiceForm.choiceBox.options[i] = null;
}
}
boxLength = document.choiceForm.choiceBox.length;
}
}
function saveMe() {
var strValues = "";
var boxLength = document.choiceForm.choiceBox.length;
var count = 0;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
if (count == 0) {
strValues = document.choiceForm.choiceBox.options[i].value;
}
else {
strValues = strValues + "," + document.choiceForm.choiceBox.options[i].value;
var url='<? echo "1" ?>';
}
count++;
}
}
if (strValues.length == 0) {
alert("No has hecho ninguna selección");
}
else {
alert("Aquí están los valores seleccionados:\r\n" + strValues);
}
}
// End -->
</script>
</head>
<html>
<BODY>
<p align="center"><b>Selecciona elementos en lista 2</b></p>


<center>
<form name="choiceForm" method="get" action="2.php">
<table border=0 width="414">
<tr>
<td valign="top" width=227>
<font size="2">Contenido disponible: </font>
<br>
<select name="available" size=10 onchange="moveOver();">
<option value=1>Noticias de la compañía
<option value=2>Noticias de industria
</select>
</td>
<td valign="top" width="177">
<font size="2">Tu selección: </font>
<br>
<select multiple name="choiceBox" style="width:150;" size="10">

</select>
</td>
</tr>
<tr>
<td colspan=2 height=10 width="390">
<input type="button" value="Eliminar seleccionados" onclick="removeMe();" style="font-size: 8pt">
<input type="button" value="Obtener valores seleccionados" onclick="saveMe();" style="font-size: 8pt">
</td>
</tr>
</table>
<p>
<input type="submit" name="Submit" value="Enviar">
</p>
</form>
</center>

</body>
</html>

Asias por todo!!!
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 21:34.