Instant Validation jQuery Plugin
September 21st, 2010
(Latest release, v2.0 on 10/07/2010)
Instant validation provides users with immediate form validation errors, correcting user input as soon as it’s entered rather than waiting for form submission. The appearance and position of the validation error messages are easily styled through CSS and plugin options. Currently available validation types include required fields, email addresses, phone numbers, zip codes, and numbers, but more will be added!
Create your form and all of its inputs. For each input that requires validation:
- Enter the validation error you want to appear as the input’s title attribute.
- Give the input a class to indicate validation type. The current validation types are:
- requiredText – any characters must be entered
- emailAddress – a valid email address must be entered
- int – a whole number must be entered
- phone – a 10 digit number with dashes must be entered (111-222-3333)
- zip – five digits must be entered
- If a field can either be empty or match a specific input type, assign it a class of “orEmpty” in addition to the validation type.
- Tell the plugin where the validation error should appear by giving it a class of:
- showTop – default value which will be used if no display class is provided
1: <input title="Please enter a valid email address." class="emailAddress" type="text" /> 2: <input title="Entere a 5 digit zip code." class="zip showBottom orEmpty" type="text" /> 3: <input title="Please enter your phone number formatted 111-222-3333." class="phone showRight orEmpty" type="text" />
Do not add any of the Instant Validation classes on inputs that require no validation.
Target the parent form(s) of your validated inputs to initialize the plugin.
- fadeSpeed - the speed at which the validation messages fade in and out