The LeadSpend Email Validation jQuery Plugin automatically validates email addresses as soon as they are typed in, and is designed to work well with your current site no matter how you're validating the form.
This plugin was designed to work right out of the box with zero-configuration. All you need to do is:
- Import jquery
- Import jquery.leadspendemail.js
- Add the class "leadSpendEmail-noconfig" to the email input on your form
- The LeadSpend result will appear in a hidden input on your form
LeadSpend Email Validation is also a fully featured jQuery plugin. This means that it is called using a jQuery selector, and can be passed a map of options, or PlainObject. To use custom options, remove the "leadSpendEmail-noconfig" class from your email input and call the plugin directly:
$(function(){
$('{email-input-selector}').leadSpendValidate( options );
});The following options may be passed to the plugin:
| Name | Description | Value | Default |
|---|---|---|---|
| timeout | The timeout, in seconds. | Integer (in the range [3, 15]) | 5 |
| debug | Enables console logging of events/data. | Boolean | false |
| delaySubmit | Delays form submission until API call returns. | Boolean | true |
The email validation result will be stored in a hidden input as part of your form. This input will have the following attributes:
- name = "{name of your email input}-result"
- id = "{id of your email input}-result" (or "" if ID was not set on your form)
- class = "leadSpendEmail-result"
When a result is returned, the "change" event is triggered on the hidden result input.
LeadSpend defines the validity of an email address as follows:
| Value | Description |
|---|---|
| verified | Mailbox exists, is reachable, and not known to be illegitimate or disposable. |
| disposable | Domain is administered by disposable email provider (e.g. Mailinator). |
| unreachable | Domain has no reachable mail exchangers (see discussion, below). |
| illegitimate | Seed, spamtrap, black hole, technical role account or inactive domain. |
| undeliverable | Mailbox or domain does not exist, or mailbox is full, suspended or disabled. |
| unknown | We were unable to conclusively verify or invalidate this address. |
More detail can be found at our API Documentation.
In addition to these result codes, this plugin defines two status codes as follows:
| Value | Description |
|---|---|
| pending | The email validation API call has not yet completed. |
| error | There was an error while making the API call to the LeadSpend servers. |
Included in the demo folder are a variety of pages which demostrate usage of the LeadSpendEmail plugin. These fall into two categories:
Various configurations of the plugin, by itself. This is the place to start if you plan on using the plugin with your existing front-end or server-side form validation.
- automatic.html: Fully-automatic, out of the box configuration. Automatially delays form submission until the API result has returned.
- custom.html: Demonstrates passing basic configurations to the plugin, such as debugging, timeout and turning off delaySubmit.
Demonstrates the use of the plugin in conjunction with jQuery Validate. If you have no existing validation on your form or would like to quickly add very good JavaScript validation, this is for you. jQuery Validate is an extremely powerful tool that allows you to add specific validation controls to your form by simply adding CSS classes. Find out more in the jQuery Validate documentation.
- automatic.html: Fully-automatic, out of the box configuration using the zero-configuration jquery.leadspendemail.js in conjunction with jQuery Validate. Includes a script which configures jQuery Validate for fully automatic form validation.