This is my preferred method of form validation. I use server side code to loop through all required fields and build error message in loop:
<% if request("submit1") <> "" then '<---THIS IS SUBMIT BUTTON NAME for each fld in Request.Form if left(fld, 4) = "req_" then 'CHECK FOR REQUIRED "req_" if trim(Request.Form(fld)) = "" then fldname = replace(fldname, "req_", "") 'REPLACE "req_" fldname = replace(fldname, "_", " ") 'REPLACE "_" errormsg = errormsg & "<br><font color=red size=2><B>" & ucase(fldname) & " is required *</b></font>" 'JUST USE NAME OF FIELD end if end if next end if response.write "Error:" & errormsg %>
Then you name your required field names with req_ in the name, like:
First Name: <input type=text name="req_first_name"><br> Last Name: <input type=text name="req_Last_name"><br> Company: <input type=text name="company"><br>
See that Company doesn't have req_, and therefore will not be required.