Simple Form Validation

Posted on in Uncategorized

Screen shot 2014-04-21 at 10.30.38 PMWebsite forms offer users with a convenient way to communicate with you as a business owner. You can offer forms a wide variety of purposes throughout your web pages. Common forms include contact forms, sign-up forms and order forms. While adding forms to your website isn’t overly difficult, you should always work with your web development professional to ensure that simple form validation is implemented.

Simple form validation is used to validate data in HTML forms before sending the content to a server. JavaScript is commonly used for form validation. Form data is generally checked by JavaScript for the following:

  • Did the user leave any required fields empty?
  • Did the user enter a valid email address?
  • Did the user enter a valid date?
  • Did the user enter text in a numeric field?

While the above examples are not exhaustive by any means, they provide an idea of why simple form validation is important. Here is an example of Javascript form validation for required fields:

function validateForm()
var x=document.forms[“myForm”][“fname”].value;
if (x==null || x==””)
alert(“First name must be filled out”);
return false;

This function checks to see if a field has been left empty. If the field is left empty, an alert box comes up with a message, the function will return as false and the form will not be submitted to the server. If you want to add forms to your website, you’ll need to implement simple form validation to ensure that your forms are completed correctly by users prior to their submission. Remember to contact your web development professional for assistance in setting up your forms on your website.

Do you use forms on your website?

What our clients are saying

I want to thank you for your help with our website development project. Your programming skills, attention to detail, and ability to interact directly with our client were excellent. You have provided tremendous value to my organization. With a project of this magnitude, including the use of web services to push data out to 19 sub-websites, your ability to overcome our unique challenges and coordinate with my IT team was exceptional. I appreciate your help, and I am certain that your expertise was key to the project's success. Thanks again, I look forward to working with you on our next endeavor!

~ John Forgione – Executive Vice President – SFA Marketing, Inc.

Read More