JavaScript Coder

Form Validation

How to Use the Dreamweaver Form Validation Feature

Sometimes, you may feel frustrated when you look at the form submissions that you get from a web form and find out that the respondents did not fill in some crucial details. This calls for some details on the form to become mandatory to fill in. for example, a form that is used to subscribe visitors to regular newsletters via email will be of no use if the user does not enter their email address.

Continue Reading →

JavaScript zip code validation

Zip code is the postal code used by the United States Postal Service (USPS). The basic format consists of 5 digits. Later, an extended code was introduced that contains a hyphen and 4 more digits. Some valid Zip Codes: 20521-9000 42223 85254 Here is a simple function to validate a ZIP code: function isUSAZipCode(str) { return /^\d{5}(-\d{4})?$/.test(str); } This function uses a regular expression that checks for 5 digits ( \d{5} ) followed by optional hyphen and four digits( (-\d{4})?

Continue Reading →

The Most Indispensable jQuery Form Validation Reference Guide

Using a library to do form validation can save lots of your development time. Being a tested and proven library guarantees it. jQuery Form validation library is the most popular validation library. This post collects all my notes and references on jQuery Form validation library. This includes a large bunch of sample code and a complete reference guide to all the built-in validation rules in the library. Reference Links: Website: http://jqueryvalidation.

Continue Reading →