Common validation in the Jquery Easyui framework

Source: Internet
Author: User

For Validatebox space, verify that the maximum value of its input character length exceeds the field length set in the database. Here's how:

1 /**2 * Verify input character length3 */4 $.extend ($.fn.validatebox.defaults.rules, {5 maxLength: {6Validatorfunction(value, param) {7 if(Value.length >= param[0]) {8 //showmsg ("Input information length must not exceed" + param[0] + "characters", 0,-1);9 if($ ("#owner"). Validatebox ("GetValue"). Length > Param[0]) {Ten$ ("#owner"). Validatebox ("SetValue", "" "); One } A return false; - } - //return value.length <= param[0]; the },  -Message: " - } -});

The label settings on the JSP page are as follows:

1  <  ID= "owner"2  class= "Easyui-validatebox"3  Invalidmessage= "cannot exceed 30 characters!" "4  data-options=" Autowidth:true,required:true,5  Validtype : ' maxlength[30] '>

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.