Why won't this work?
I am passing the name of the form (I have two that use this validation
script) but I keep getting an error.
Error reads: "document.which _form.name is null or not an object"
HTML-----------
Form is ----> <form action="thanks. php" method="post" name="contact_f orm"
id="contact_for m">
Name -------> <input type="text" name="name" id="name" size="25">
Button sends code -----> <input type="button" value="Submit Form"
onClick="contac t_validate('con tact_form')">
JAVASCRIPT-----------
function contact_validat e(which_form) {
var field_errors = "The following field(s) are required: \n\n";
var errors = 0;
// If name is null
if (document.which _form["name"].value == '') {
//alert("Please enter your name");
//return;
field_errors = field_errors+"N ame - Please enter your name \n";
errors++;
}
Thanks,
CWJ
I am passing the name of the form (I have two that use this validation
script) but I keep getting an error.
Error reads: "document.which _form.name is null or not an object"
HTML-----------
Form is ----> <form action="thanks. php" method="post" name="contact_f orm"
id="contact_for m">
Name -------> <input type="text" name="name" id="name" size="25">
Button sends code -----> <input type="button" value="Submit Form"
onClick="contac t_validate('con tact_form')">
JAVASCRIPT-----------
function contact_validat e(which_form) {
var field_errors = "The following field(s) are required: \n\n";
var errors = 0;
// If name is null
if (document.which _form["name"].value == '') {
//alert("Please enter your name");
//return;
field_errors = field_errors+"N ame - Please enter your name \n";
errors++;
}
Thanks,
CWJ
Comment