Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/06/2011, 22:33
barmancity
 
Fecha de Ingreso: junio-2011
Mensajes: 1
Antigüedad: 12 años, 10 meses
Puntos: 0
Pregunta Validar formulario dinamico innerHTML

Hola comunidad muchas gracias de antemano tengo un inconveniente,
tengo que validar unos campos que se generan con java script. el problema surge
cuando quero validarlos solo me valida el primero, se que tengo que hacer un bucle pero no se como hacerlo. aca pego el codigo para vean donde estoy comentiendo el error. desde ya muchas garcias.


var numero = 0;
function addNewRow()
{

var TABLE = document.getElementById("tabla");

var TROW = document.getElementById("celda");


var content = TROW.getElementsByTagName("td");


var newRow = TABLE.insertRow(-1);
newRow.className = TROW.attributes['class'].value;


var newCell = newRow.insertCell(newRow.cells.length)


newID_1 = 'dsc[]';


txt = '<textarea name="' + newID_1 + '" id="dsc" cols="60" rows="3"></textarea>'
// y lo asignamos a la celda
newCell.innerHTML = txt



}



function removeLastRow()
{

var TABLE = document.getElementById("tabla");


if(TABLE.rows.length > 2)
{
TABLE.deleteRow(TABLE.rows.length-1);
--numero;
}
}

function valida_envia() {



if (document.getElementById(innerHTML='dsc').value.le ngth==0)
{
alert("La descripcion esta vacia")
document.getElementById(innerHTML='dsc').focus()
return 0;
}

if (document.formulario.chek.checked){
alert("Muchas gracias por enviar el formulario");
document.formulario.submit();
}
else {
alert("Por favor revise los datos ingresados y puse sobre la casilla de verificacion");
document.formulario.chek.focus()
return 0;
}

}