OK, call me a glutton for punishment but I am a professional bug finder and fixer by trade...
I copied the source you posted in your original message into a source document and uploaded it to my server. I had to initialize $MAX because I couldn't see where it was coming from, and I commented out the "if" line and replaced it with one that guaranteed that the block would be entered to generate the javascript.
I also put the form html at the bottom of the script (I don't know where yours generates from).
Here is the resulting source:
<head>
<title>hullo</title>
</head>
<body>
<?php
$MAX = 2;
echo "\n\n<script Language=\"JavaScript\">\n";
echo "<!--\n";
echo "function Form_Validator() {\n";
for ($x = 0; $x <= $MAX; $x++) {
if((isset($ORDER[$x])) && ($ORDER[$x] == "checked")) {
if(1==1) {
echo "\t\tif (document.myForm.QUANTITY$x.value == \"\") {\n";
echo "\t\t\talert(\"You must enter a value for the Quantity field.\")\n";
echo "\t\t\tdocument.myForm.QUANTITY$x.focus();\n";
echo "\t\t\treturn (false);\n";
echo "\t\t}\n";
echo "\t\tif (document.myForm.DOCKDATE$x.value == \"\") {\n";
echo "\t\t\talert(\"You must enter a value for the Dock Date field.\")\n";
echo "\t\t\tdocument.myForm.DOCKDATE$x.focus();\n";
echo "\t\t\treturn (false);\n";
echo "\t\t}\n";
}
}
echo "\treturn (true);\n";
echo "}\n";
echo "//-->\n";
echo "</script>\n";
?>
<form name="myForm" action="test3.php" onsubmit="return Form_Validator();">
<input type="text" name="QUANTITY0">
<input type="text" name="DOCKDATE0">
<BR>
<input type="text" name="QUANTITY1">
<input type="text" name="DOCKDATE1">
<input type="submit">
</form>
</body>
I hit the page with my browser (NS Communicator 4.6) and it works! I don't understand because the bulk of the page is cut and pasted directly from your original post!
I tried both "onsubmit" styles like you said and they both worked, too.
Maybe you can see what is different (maybe your form generation?) between this one and the one you are running.
Hope some of this has been helpful to you...
-- Rich Rijnders
-- Irvine, CA US