Jquery Validate related parameters and common custom validation rules

Source: Internet
Author: User
Tags min valid
Jquery Validate related parameters

Defining Chinese messages
var cnmsg = {
Required: "Required field",
Remote: "Please fix this field",
Email: "Please enter the correct format of e-mail",
URL: "Please enter a valid URL",
Date: "Please enter a valid date",
Dateiso: "Please enter a valid date (ISO).",
Number: "Please enter a valid digit",
Digits: "Can only enter integers",
CreditCard: "Please enter a valid credit card number",
Equalto: "Please enter the same value again",
Accept: "Please enter a string with a valid suffix name",
Maxlength:jQuery.format ("Please enter a string with a maximum length of {0}"),
Minlength:jQuery.format ("Please enter a string with a minimum length of {0}"),
Rangelength:jQuery.format ("Please enter a string between {0} and {1}"),
Range:jQuery.format ("Please enter a value between {0} and {1}"),
Max:jQuery.format ("Please enter a value of {0} max"),
Min:jQuery.format ("Please enter a value of minimum {0}")
};
Jquery.extend (JQuery.validator.messages, cnmsg); Jquery Validate validation rules

(1) Required:true required field
(2) Remote: "check.php" using Ajax method call check.php Validate input value
(3) Email:true must enter e-mail in the correct format
(4) Url:true must enter the correct format of the URL
(5) Date:true must enter the correct format of the date
(6) Dateiso:true must enter the correct format of the date (ISO), for example: 2009-06-23,1998/01/22 Verify the format only, do not validate the validity of
(7) Number:true must enter a valid number (negative, fractional)
(8) Digits:true must enter an integer
(9) CreditCard: Must enter a valid credit card number
(10) Equalto: The "#field" input value must be the same as #field
(one) Accept: Enter a string that has a legal suffix (the suffix of the uploaded file)
(5) The string with a maximum length of maxlength:5 input (Chinese characters counted as a character)
(minlength:10) Enter a string with a minimum length of 10 (Chinese characters counted as one character)
(rangelength:[5,10] Enter a string that must be between 5 and 10 ") (Chinese characters are counted as one character)
(a) range : [5,10] Input value must be between 5 and 10
(+) Max:5 input value cannot be greater than 5
Min:10

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.