// // Returns true if all of the non-optional fields in the given // form have been assigned values. If a value is missing, a // non-null error message is returned. If a label attribute // is defined for that field, then it will be used in the // error message. For example, the following code segment // validates a form with two required fields and one optional field: // // form.field1.label = "Field 1"; // form.field2.label = "Field 2"; // form.field3.optional = true; // // var err = validateForm(form); // if (err) alert(err); // function validateForm (form) { // Check for all required (non-optional), non-hidden field values for (i=0; i