JQuery Form Verification plug-in parsing (recommended), jquery form
I. Plug-ins
(1) validform_v5.3.20.min.js Validform_Datatype.js
(2) Website: http://validform.rjboy.cn
The demo and plug-in download links are available on this website.
II. General Verification
(1) Validform_Datatype.js
/* Validform datatype extensionBy sean during December 8, 2012-February 20,201 3For more information, please visit http://validform.rjboy.cn extends the following types: date: Match date zh: Match Chinese Character dword: match Double Byte Character money: Match currency type ipv4: Match ipv4 address ipv6: Match ipv6 address num: Match numeric qq: Match qq number unequal: the current value cannot be equal to the detected value, for example, the new password cannot be the same as the old one. notvalued: the current value cannot contain the specified value. For example, the password cannot contain the user name. min: How many items are selected in the multiple selection box? max: maximum number of items in the Multi-choice box: byterange: determines the length of a character. The Chinese character counts two characters numrange: determines the value range. For example, if the value is less than 100 or greater than 10, daterange: determines the date range idcard: perform strict verification on the ID card number */
(2) Validform v5.3.1
Var tipmsg = {tit: "prompt message", w: {"*": "cannot be blank! "," * 6-16 ":" Enter 6 to 16 characters! "," N ":" enter a number! "," N6-16 ":" Please fill in 6 to 16 digits! "," S ":" special characters are not allowed! "," S6-18 ":" Please fill in 6 to 18 characters! "," P ":" Enter the zip code! "," M ":" Enter your mobile phone number! "," E ":" The email address format is incorrect! "," Url ":" Enter the url! "," W1 ":" must begin with a letter, can contain digits, underline characters "}, def:" Please fill in the correct information! ", Undef:" datatype is not defined! ", Reck:" The two inputs are inconsistent! ", R:" pass information verification! ", C:" detecting information... ", S:" Please {enter | select} {0 | information }! ", V:" The entered information has not been verified. Please wait... ", P:" submitting data... "}
(3) Use
<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 blank "errormsg =" date Format incorrect! ">
Add the attribute datatype to input. Nullmsg is a prompt when it is null, and errormsg is a prompt when it does not meet the format of the ype attribute.
Iii. Special Verification
(1) Special Verification means that when the methods provided in js cannot meet the actual requirements, you need to write the corresponding ype to meet the requirements.
For example, the end time is not earlier than the start time:
$ (". Registerform "). validform ({datatype: {"enddate": function (gets, obj, curform, regxp) {/* The gets parameter is the value of the obtained form element, and obj is the current form element, curform is the form currently verified, and regxp is a reference to some 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 the jQuery Form Verification plug-in resolution (recommended) introduced by xiaobian. I hope it will help you. If you have any questions, please leave a message and I will reply to you in time. Thank you very much for your support for the help House website!