Really basic form validation

As I know this will help someone, here’s a simple way to use form validation.

One important bit: The function to go in the <head>.

[code lang=”js”]


And make sure you text boxes have an "ALT" attribute, like this for example:
<input type="text" name="fname" id="fname" alt="First Name" />
Important! Only put an ALT attribute for the required inputs!

Finally, tuck this little bit into your <form> tag you want to use:
<form name="contactform" onsubmit="return(checkForm(this));" method="..  >