VICTOR JONSSON

jQuery Form Validator

This plugin was created to minimize javascript logic in the html code when dealing with front-end validation of form data.

Usage example

Live demo

Required
Minimum 5 characters
Max 5 characters
Length between 3-5 characters
E-mail
Domain
Url
Float
Integer
Time HH:mm
Date yyyy-mm-dd (Custom date format is also possible)
Birthdate yyyy-mm-dd
Valid telephone number
Valid Swedish mobile telephone number
Valid Swedish social security number yyyymmddXXXX
UK VAT Number
Custom validation Simple captcha, this field has to contain value "jqueryvalidation"
One of these radio buttons has to be checked
Yes
No
Maybe
These two inputs has to have identical values (minimum 3 characters)
Website, optional (this input will only be validated if it has a value)
E-mail (this input will not be validated unless this checkbox is checked )
Length restriction 50 characters left
These features applies to select lists as well
These features applies to select lists with multiple options as well. You have to select at least two answers from this list and you'r not allowed to select "* Not allowed"

Features

  • validate_url
  • validate_date — yyyy-mm-dd (format can be customized, more information below)
  • validate_birthdate — yyyy-mm-dd, not allowing dates in the future or dates that is older then 122 years (format can be customized, more information below)
  • validate_email
  • validate_time — hh:mm
  • validate_domain — domain.com
  • validate_phone — atleast 7 digits only one hyphen and plus allowed
  • validate_swemob — validate that the value is a swedish mobile telephone number
  • validate_float
  • validate_int
  • validate_length — Validate that input length is in given range (length3-20)
  • validate_confirmation
  • validate_spamcheck
  • validate_ukvatnumber
  • validate_swesec — validate swedish social security number
  • required — no validation except that a value has to be given
  • validate_custom — *Validate value against regexp (validate_custom regexp/^[a-z]{2} [0-9]{2}$/)
  • validate_num_answers — Validate that a select element has the required number of selected options (validate_num_answers num5)
  • Show help information automatically when input is focused
  • Validate given values immediately when input is blurred.
  • Make validation optional by adding attribute data-validation-optional=”true” to the element. This means that the validation defined in data-validation only will take place in case a value is given.
  • Make validation dependent on another input of type checkbox being checked by adding attribute data-validation-if-checked=”name of checkbox input”