Hey guys. I am dynamicaly creating a form with a select box and a text box.
The form will have 1-however many rows. The select box and text box are arrays.
On the form submit I call a javascript function Validate to compare the two fields on each row. For some reason I am getting an error that says "value is null or not an object".
Here is the javascript I have
function Validate() {
var selNewStatus = document.myForm.selNewStatus;
var txtRO = document.myForm.txtRO;
var err = "Please Make These Corrections....";
for (i = 0; i < document.myForm.selNewStatus.length; i++) {
if(selNewStatus[i].value == "Approved" && txtRO[i].value == ""){
err+="\nYou must enter an RO when marking an estimate approved. Line Number: "+(i+1);
}//end if
}//end for
if(err != "Please Make These Corrections...."){
alert (err);
return false;
}//end if
}//end Validate
the two form elemets are named like so
<select name="selNewStatus[]" id="selNewStatus">
<option value="None" selected>No Change</option>
<option value="Approved">Approved</option>
<option value="Lost">Lost</option>
</select>
<input name="txtRO[]" type="text" class="textRow" id="txtRO" value="<?php echo $ro; ?>">
Any idea why this is not working? It is driving me nuts.
Thanks for the help!