D
daniel.boorn
Form validation using JavaScript has never been as easy and simple! We
have developed a free generic form validation script that can validate
any form with very little JavaScript required in form!
For example:
A normal HTML form with out validation:
<form action="foobar.htm" method="get">
<div>Name: <input type="text" name="customerName" value=""></div>
<div>Email: <input type="text" name="customerEmail" value=""></div>
<div>Zip: <input type="text" name="customerZip" value=""></div>
<div><input type="submit" value="Submit"></div>
</form>
Simply add a few more attributes and you now have form validation:
<form action="foobar.htm" method="get">
<div>Name: <input type="text" required="yes" validate="text"
message="Please enter your name." name="customerName" value=""></div>
<div>Email: <input type="text" required="yes" validate="email"
message="Please enter a valid email address" name="customerEmail"
value=""></div>
<div>Zip: <input type="text" required="yes" validate="int"
message="Please enter a zip code" name="customerZip" value=""></div>
<div><input type="submit" value="Submit"
onClick="validate(this.form); return document.formSubmit;"></div>
</form>
You can get a free copy of the script here:
http://dboorn.com/javascript_form_validation.php?catID=69. Please feel
free to download and use for any of your needs. As always please feel
free to let me know your thoughts!
have developed a free generic form validation script that can validate
any form with very little JavaScript required in form!
For example:
A normal HTML form with out validation:
<form action="foobar.htm" method="get">
<div>Name: <input type="text" name="customerName" value=""></div>
<div>Email: <input type="text" name="customerEmail" value=""></div>
<div>Zip: <input type="text" name="customerZip" value=""></div>
<div><input type="submit" value="Submit"></div>
</form>
Simply add a few more attributes and you now have form validation:
<form action="foobar.htm" method="get">
<div>Name: <input type="text" required="yes" validate="text"
message="Please enter your name." name="customerName" value=""></div>
<div>Email: <input type="text" required="yes" validate="email"
message="Please enter a valid email address" name="customerEmail"
value=""></div>
<div>Zip: <input type="text" required="yes" validate="int"
message="Please enter a zip code" name="customerZip" value=""></div>
<div><input type="submit" value="Submit"
onClick="validate(this.form); return document.formSubmit;"></div>
</form>
You can get a free copy of the script here:
http://dboorn.com/javascript_form_validation.php?catID=69. Please feel
free to download and use for any of your needs. As always please feel
free to let me know your thoughts!