Form and Spelling Validation
(Page 1 of 14 )
Most dynamic web sites rely heavily on forms. From user authentication to entry of news items, we use forms to accept user input. There are many different ways we can validate data from the user. In this tutorial, we will examine several of the more common items that need validation and provide examples for each. We will also explore how to check documents for misspelled words and suggest proper replacements.
Most dynamic web sites rely heavily on forms. From user authentication to entry of news items, we use forms to accept user input. There are many different ways we can validate data from the user. In this tutorial, we will examine several of the more common items that need validation and provide examples for each. We will also explore how to check documents for misspelled words and suggest proper replacements.
Common Form Validations - We will use a combination of string functions and regular expressions to validate common data submitted via forms.Spell Checking - Web sites with misspellings look unprofessional. In this section, we will detail how to spell check text input from a form. The spell check script examined in this section will present a practical demonstration of how regular expressions and standard string functions can be used together to perform a useful function.
Before we jump into the examples, let's talk a little bit about form validations in general. First off, what is form validation? Simply put, it is the process of validating information from a form. This information will vary greatly and could be anything from proper names to zip codes. Validating the data means ensuring that it complies to a set of rules or guidelines.
You may be wondering why we need to validate data from forms. If we don't validate data coming in from forms, we could end up with totally useless information. Imagine you have a form where you have three fields - name, phone number, and email address. What good does it do you if someone enters in garbage in each of these fields? If you aren't validating the information from these fields, you have no way of controlling the information.
Another important aspect of form validation is security. By validating the information you receive via a form before using it elsewhere, you can reject or strip out any potentially harmful data and avoid a security breach. It certain situations it is important to be sure that you aren't accepting overly long data. If you were to accept user input from a form and then input that into your database without checking the length of the data submitted, a malicious person could quickly fill up your database.
In this tutorial, we will explore validation of forms so that you can be sure that the data you are collecting is as you would hope for it to be.
Next: Common Form Validations >>
More Miscellaneous Articles
More By Matt Wade