View Single Post
  #2 (permalink)  
Old 08-02-07, 09:14 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Hi,

It is only validating the first row, because all 5 function get the same name:

Code:
function checkform()
{
    ........ check row 1
}
Code:
function checkform()
{
    ........ check row 2
}
When you submit the form, you run function checkform(). Javascript will allways take the top function, so always row 1.

You need to change your javascript to loop through the rows and take it out of your recordset loop, so it doesnt get added 5 times. Simple example:

Code:
function checkform()
{
var error_message;

error_message = "Please complete the following fields\n";

for(var i=1;i ==5;i++)
{
var loaddate = document.main_form.loaddate + i;
if(loaddate.value == "") {
error_message = error_message + "\n - loaddate is missing for record no." + i;
} } if (error_message == "Please complete the following fields\n") {
return true;
} else {
alert (error_message);
return false; } }

Last edited by Yeroon; 08-02-07 at 09:16 AM.
Reply With Quote