jquery Form Verification plug-in resolution (recommended) _jquery

Source: Internet
Author: User

One: Plug-ins

(1) Validform_v5.3.1_min.js validform_datatype.js

(2) Web site: http://validform.rjboy.cn

There are demo and plugin download links on this site.

II: General Verification

(1) Validform_datatype.js

/*
validform datatype extension by
Sean during December 8, 2012-february, 2013 for more
information, plea The SE visit http://validform.rjboy.cn
extends the following types: Date
: match date
en: Match Chinese character
dword: matching Double-byte characters
Money: Matching currency type
IPv4: matching IPv4 address
IPv6: matching ipv6 address
num: Matching numeric
QQ: matching QQ number
unequal: The current value cannot equal the value being detected, If it can be used to detect the new password can not be as notvalued as the old password
: The current value can not contain the specified value, such as password can not contain the user name and so on detection
min: Multi-selection box at least how many items
Max: No more than
a few options Byterange: Judge the length of characters, Chinese two characters
Numrange: Judge the range of values, such as the number of less than 100 greater than 10
DateRange: Judge the date range
Idcard: Strict verification of the identity card number
*/

(2) ValidForm v5.3.1

var tipmsg = {
Tit: "Prompt info",
w: {
"*": "Cannot be empty!") ",
" *6-16 ":" Please fill out 6 to 16 bits of any character! ",
" n ":" Please fill in the number! ",
" n6-16 ":" Please fill out 6 to 16 digits! ",
" s ":" Cannot enter special characters! ",
" s6-18 ":" Please fill out 6 to 18 characters! ",
" P ":" Please fill in the ZIP code! ",
" M ":" Please fill in the Mobile phone number! ",
" E ":" Mailbox address format is not correct! ",
" url ":" Please fill in the URL! ",
" W1 ":" must enter the letter beginning, can be digitally, underlined character "
},
def:" Please fill in the correct information! " ",
undef:" DataType not defined! ",
Reck:" Two times the content of the input is inconsistent! ",
R:" Through information verification! ",
C:" Testing information ... ",
s:" Please {fill in | select}{0| Information}! ",
V:" The information is not validated, please later ... ",
P:" Submitting Data ... "
}

(3) using

<input name= "StartTime" class= wdate "onclick=" Wdatepicker ({datefmt: ' Yyyy-mm-dd HH:mm:ss '}) ' style= ' width:150px '
value= "datatype=" date "nullmsg=" Start time cannot be empty "errormsg=" date format is not correct! ">

Add attribute datatype to input. Nullmsg is the prompt for null, errormsg is the prompt that does not satisfy the DataType property format.

Third: Special verification

(1) Special verification refers to the method provided in JS can not meet the actual needs, the need to write their own corresponding datatype to meet the needs.

For example, the end time is not less than the start time:

$ (". Registerform"). ValidForm ({
datatype:{
"EndDate": function (GETS,OBJ,CURFORM,REGXP) {/
* parameter gets is the value of the form element that
is fetched. Obj is the current form element,
Curform is the currently validated form, and
Regxp is a reference to some of the built-in regular expressions. *
/var reg1=regxp["date"],
startdate=curform.find ("[Name=starttime]"). Val (),
enddate=gets;
if (Reg1.test (enddate) &&startdate<enddate) {return true;}
return false;
} 
,
ajaxpost:true

The above is a small series to introduce the jquery form verification plug-in analysis (recommended), I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.