JQuery Plugin Repository

Close Complete List of Plugins

validateForm  |  Category: Forms  |  Modified: 16 Feb 2010  |  Perform checks on forms fields for required data and selected formatting.

This plugin is applied to a form, creating a client-side validation step when the form is submitted. The validation verifies that all required fields contain data, that known data types (e.g., date, e-mail, phone, zip, among others) are correctly formatted, and that confirmation fields (i.e., passwords and e-mail addresses) match.

Summary

Script File

jq.validateForm.js ( view )

Available Options

validateAt

A string specifying when the validation should occur. Options include "blur" (when a viable field loses focus), "submit" (whent he form is submitted), or "both". Default value is "both".

dFormat

A string denoted the preferred date format. Default value is "mm/dd/yyyy". Other options are "mm-dd-yyyy", "m/d/y", or "m-d-y".

passMin

An integer specifying the minimum number of characters required for a password entry. Default value is 8.

msg_error

A string specifying the global error message displayed above the form on a submit attempt, if there are errors. Default value is "Please address the errors noted below...".

msg_warning

A string specifying the global warning message displayed above the form on a submit attempt, if there are warnings. Default value is "Please address the warnings noted below...".

Basic Usage

$("#FRM").jqValidate();
$("#FRM").jqValidate({ options });

where FRM is the ID of the form containing the element(s) to be validated.

Minimum Browser Support

  • Apple Safari 3
  • Google Chrome 1
  • Microsoft Internet Explorer 6
  • Mozilla Firefox 3
  • Opera 9

Example

This module uses the default settings, except overriding the minimum password length to 6.

  1. indicates required field(s)
  1. (must be 4 numbers)
  2. (must be at least 6 characters)
  3. (cut-n-paste is not allowed)
  1. (mm/dd/yyyy)
  2. - - (123-45-6789)
  3. (user@domain.com)
  4. (http://www.domain.com)
  5. / - ext. (555/555-5555 5555)
  6. - (12345 or 12345-6789)
  1. Option 1A   Option 1B   Option 1C   Option 1D  
  2. Option 2A   Option 2B   Option 2C   Option 2D  
  1.  |  Clear Form

Associated Code

<script type="text/javascript">
$(document).ready(function() {
  $("#myForm").jqValidate({
    passMin : 6
    });
  });
</script>

JQuery Plugin Repository | Home | Print

back to ksscholl.com