• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 29. Performing Form Validation > Checking for Invalid Data

Checking for Invalid Data

The final validation stage for a form is checking the data to make sure it conforms to your requirements. This involves checking numeric data that must fall within a certain range, making sure that certain characters are present in a field, removing extraneous characters from a field, and writing custom validation routines for specific data types (such as e-mail addresses). The rest of this chapter presents various functions that perform these and other validation tasks.

Checking a Numeric Range

Besides checking to see if a field contains an integer or floating-point value as we did in the previous few sections, you might also need to ensure that a numeric value falls within a certain range. For example, an interest rate value should be greater than 0 and (almost always) less than 100 (assuming your script will convert this value into a percentage by dividing it by 100).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint