Home > Web Front-end > JS Tutorial > jQuery EasyUI API Chinese Documentation - ValidateBox validation box_jquery

jQuery EasyUI API Chinese Documentation - ValidateBox validation box_jquery

WBOY
Release: 2016-05-16 18:01:20
Original
953 people have browsed it

rewrote defaults with $.fn.validatebox.defaults .


Usage

Copy code The code is as follows:



Copy code The code is as follows:

$('#vv').validatebox({
required:true
});

Validation rules
Validation rules are defined by using the required and validType attributes. Here are the rules that have been implemented:
email: Matches email regular expression rule
url: Match URL regular expression rules
length[0,100]: allow characters from x to y
remote['http://.../action.do','paramName']: send an ajax request to verify Value, returns 'true' on success.
To customize validation rules, override $.fn.validatebox.defaults.rules to define a validation function and invalid information. For example, define a minLength validation type:
Copy code The code is as follows:

$.extend( $.fn.validatebox.defaults.rules, {
minLength: {
validator: function(value, param){
return value.length >= param[0];
},
message: 'Please enter at least {0} characters.'
}
});

Now you can use this minLength validation type to define a minimum input of 5 characters Character input box:
Copy code The code is as follows:



特性

名称

类型

说明

默认值

required

boolean

定义是否字段应被输入。

false

validType

string

定义字段的验证类型,比如 emailurl,等等。

null

missingMessage

string

当文本框是空时出现的提示文字。

This field is required.

invalidMessage

string

当文本框的内容无效时出现的提示文字。

null

方法

名称

参数

说明

destroy

none

移除并且销毁这个组件。

validate

none

进行验证以判定文本框的内容是否有效。

isValid

none

Call validate method and return the verification result, true or false.


Windy translation.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template