Jquery ValidateEngine Form Verification

Source: Internet
Author: User

Usage: http://www.position-relative.net/creation/formValidator/demoValidators.html

1. Introduce js jquery. js and jquery. validateEngine. js into the page.

2. Write the class such as class = "validate [required]" on the form to be verified. Available verification attributes:

Validate [required]

Validate [required, custom [url]

Validate [required, equals [password]

Validate [required, funcCall [checkHELLO]: Call the custom function checkHELLO during verification.

Function checkHELLO (field, rules, I, options ){

If (field. val ()! = "HELLO "){

// This allows to use i18 for the error msgs

Return options. allrules. validate2fields. alertText;

}

}

Validate [required, minSize [6]

Validate [required, maxSize [6]

Validate [required, custom [integer], min [-5]

Validate [required, custom [integer], max [50]

Validate [custom [date], past [2010/01/01]

Validate [custom [date], future [NOW]

Validate [custom []

 

Date

An ISO date, YYYY-MM-DD

Number

Floating points with an optional sign. ie.-143.22 or. 77 but also + 234,23

Integer

Integers with an optional sign. ie.-635 + 2201 738

Ipv4

An IP address (v4) ie. 127.0.0.1

OnlyNumberSp

Only numbers and spaces characters

OnlyLetterSp

Only letters and space characters

OnlyLetterNumber

3. Verify that $ ("# formID"). validationEngine () is executed in document. onload ();

4. Determine whether to pass jQuery ('# formID'). validationEngine ('validate') and return bool Value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.