Ciao a tutti,

qualcuno mi può spiegare perchè non riesco ad utilizzare getElementById nella funzione checkrequired che viene richiamata all'invio del form.
edit_x è il tr x-esimo

Ciao e grazie,
Paolo


codice:
function checkrequired(){
	alert(document.getElementById("edit_1"));
var pass=true;

	with(document.form_trasporti) {
		for(i=0;i<elements.length;i++) {
			thiselm = elements[i];
			
			if(thiselm.name.substring(0,13) == "data_consegna"){		
				if (thiselm.value=='' || thiselm.value==' '){
					pass=false;
					thiselm.focus();
					alert('Specificare un valore per Data di consegna');
				}
			}
			if(thiselm.name.substring(0,11) == "ton_cliente"){	
				if (thiselm.value=='' || thiselm.value==' '){
					pass=false;
				
					thiselm.focus();
					alert('Specificare un valore per Tonnellate cliente');
				}
			}
			if (pass==false) break;
			if(thiselm.name.substring(0,7) == "ton_abb"){	
				if (thiselm.value=='' || thiselm.value==' '){
					pass=false;
					thiselm.focus();
					alert('Specificare un valore per Tonnellate abbinato');
				}
			}
			if (pass==false) break;
			if (pass==false) break;
			if(thiselm.name.substring(0,6) == "ordine"){		
				if (thiselm.value=='' || thiselm.value==' '){
					pass=false;
					thiselm.focus();
					alert('Specificare un valore per Ordine');
				}
			}
			if (pass==false) break;
			if(thiselm.name.substring(0,4) == "tipo"){	
				if (thiselm.value=='' || thiselm.value==' '){
					pass=false;
					thiselm.focus();
					alert('Specificare un valore per Tipo');
				}
			}
			if (pass==false) break;
		}
	}

	return false;

}

<form method="post" action="aggiorna_trasporti.php" name="form_trasporti" onSubmit="return checkrequired();" >
<input type="submit" name="modifica" value=" modifica ">
<input type="submit" name="cancella" value=" cancella ">
<input type="hidden" name="da" value="">
<input type="hidden" name="a" value="">
<input type="hidden" name="id_trasp" value="">
<input type="hidden" name="id_cl" value="">
<table border="1" cellpadding="0" cellspacing="0" width="100%" name="table_trasporti">
<thead>
  <tr>
   <td colspan="2"></td>
   <td width="18" align="center"><input type=checkbox name=chkall onclick="sel()"></td>   <td>Consegna</td>
   <td>Trasportatore</td>
  </tr>
</thead>
<tbody>
  <tr style="background:#f2f2f6;">
   <td width="18" align="center">[img]r.gif[/img]</td>
   <td width="18" align="center">[img]transport.gif[/img]</td>
   <td width="18" align="center"><input type="checkbox" name="cancella_questo_0" value="1"></td>
   <td>12-10-2005</td>
   <td>DA ABBINARE</td>
  </tr>
  <tr id="edit_1129015638" style="background:#f2f2f6;display:none;">
   <td colspan="3"></td>
   <td><input type="hidden" id="id_trasporto[0]" name="id_trasporto[0]" value="1129015638">
   <input type="text" name="data_consegna_0" value="12-10-2005">
<a href="javascript:show_calendar('document.form_trasporti.data_consegna_0', document.form_trasporti.data_consegna_0.value);">
[img]img/cal.gif[/img]</a></p></td>
   <td><select name="id_trasportatore_0"><option></option><option value="1" >RESO</option>
<option value="2" selected>DA ABBINARE</option><option value="3" >DA ASSEGNARE</option><option value="4" >IN PARTENZA</option><option value="5" >IN SOSPESO</option></select></td>
  </tr>

  <tr style="background:#f2f2f6;">
   <td width="18" align="center"><a href="javascript:toShow('edit_1129016165','img_1129016165');">
[img]r.gif[/img]</a></td>
   <td width="18" align="center">[img]transport.gif[/img]</td>
   <td width="18" align="center"><input type="checkbox" name="cancella_questo_1" value="1"></td>
   <td>12-10-2005</td>
   <td>DA ASSEGNARE</td>
  </tr>
  <tr id="edit_1129016165" style="background:#f2f2f6;display:none;">
   <td colspan="3"></td>
   <td><input type="hidden" id="id_trasporto[1]" name="id_trasporto[1]" value="1129016165">
   <input type="text" name="data_consegna_1" value="12-10-2005">
<a href="javascript:show_calendar('document.form_trasporti.data_consegna_1', document.form_trasporti.data_consegna_1.value);">
[img]img/cal.gif[/img]</a></p></td>
   <td><select name="id_trasportatore_1"><option></option><option value="1" >RESO</option>
<option value="2" >DA ABBINARE</option><option value="3" selected>DA ASSEGNARE</option><option value="4" >IN PARTENZA</option><option value="5" >IN SOSPESO</option></select></td>
  </tr>

</tbody>
</table>
</form>