Robert Granlund
asked on
Javascript Form Validation
Is there a way to have javascript form validation that does not use a popup box, for each field missed that is required? Is there a way to show a full stylized list of all required fields, once the submit is clicked?
function validateForm()
{
var street_address=document.forms["myForm"]["street_address"].value;
if (street_address==null || street_address=="")
{
alert("A street address must be filled out");
return false;
}
var city=document.forms["myForm"]["city"].value;
if (city==null || city=="")
{
alert("A city name must be filled out");
return false;
}
}
You might be interested in OpenVL http://openvl.info/
ASKER
@AlbertVanHalen:
Thank you for your response. Is there a way to get the javascript to print on the actual page instead of in an alert box? Can it be styled?
Thank you for your response. Is there a way to get the javascript to print on the actual page instead of in an alert box? Can it be styled?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
In the example all errors are put into an array and it is being alerted if it contains items.
Open in new window