Skip to content

this-sam/jquery-leadspendemail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

LeadSpend Email Validation jQuery Plugin

Validate your email addresses without writing a single line of code!

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.

Zero-Configuration Usage

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

Custom Usage and Options

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 );
});

Options

The following options may be passed to the plugin:

NameDescriptionValueDefault
timeoutThe timeout, in seconds.Integer (in the range [3, 15])5
debugEnables console logging of events/data.Booleanfalse
delaySubmitDelays form submission until API call returns.Booleantrue

Accessing the Result

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.

Result Codes and What They Mean

LeadSpend defines the validity of an email address as follows:

ValueDescription
verifiedMailbox exists, is reachable, and not known to be illegitimate or disposable.
disposableDomain is administered by disposable email provider (e.g. Mailinator).
unreachableDomain has no reachable mail exchangers (see discussion, below).
illegitimateSeed, spamtrap, black hole, technical role account or inactive domain.
undeliverableMailbox or domain does not exist, or mailbox is full, suspended or disabled.
unknownWe 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:

ValueDescription
pendingThe email validation API call has not yet completed.
errorThere was an error while making the API call to the LeadSpend servers.

Demo Forms

Included in the demo folder are a variety of pages which demostrate usage of the LeadSpendEmail plugin. These fall into two categories:

Standalone

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.

jQuery Validate

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.

About

LeadSpend jQuery extension (JSONP implementation)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published