JQuery formvalidator Form Verification plug-in open source with API help, source code, sample _jquery

Source: Internet
Author: User
Tags numeric rar unique id
2008-07-22 14:47


Bug Description: Ajaxvalidator function After the submission of the error, stay in this page, trigger the checksum again let the prompt content has been in the onload state.


This bug has been repaired, please download it again.




2008/7/17 14:12:00 jQuery formvalidator 3.1ver


1, add the empty attribute for Inputvalidator. Lets you set whether the control text value allows both sides to be empty. Please see the DEMO1 Code of the password in the detail.
The property is an object, and the default value {Leftempty:true,rightempty:true,emptyerror:null}
Leftempty: Indicates whether NULL is allowed on the left
Rightempty: Indicates whether the right side is allowed to be empty
Emptyerror: The prompt at which the error occurs, and if NULL, the OnError property is used to prompt for an error.
Note: Use only when type: "Size", that is, when the length is compared.

2, modify the automatic construction of the hint layer syntax. Adds a Relativeid property to the Formvalidator function.
Relativeid: The ID of the control that represents the relative positioning of the hint layer and, if it is empty, the ID of the current validation control.
Tipid: The ID of the hint layer that is automatically created, and if it is empty, it is named with the id+ "Tip" of the current validation control.

3, fix the bug that beforesend attribute in Ajaxvalidator function. The code forgot to pass its unique parameters.

4, fixed ajaxvalidator function in the background can not get the Chinese bug.

5, updated the upgrade record, user manual, increased by 2 questions.
1. Live Demo
Http://img.jb51.net/online/formValidator3.1/demo.html

2, JQuery Pagevalidator plug-in main function

Supports validation of all types of client controls
Supports jquery all selector syntax, as long as the control has a unique ID and type attribute
Supports extensions of functions and regular expressions. Provide extension library formvalidatorreg.js, you are free to add, modify the content inside.
Supports 2 checksum modes. First: Text hints (Showword mode); second: pop-up Prompts (Showalert mode)
Multiple validation groups are supported. If a page has multiple submit buttons, do different to submit, before submitting to do a different checksum, so you have to use the function of the calibration group.
Support 4 kinds of state information prompt function, can control 4 kinds of states whether display flexibly. The first: When the page was opened to prompt, the second: to get the focus of the time to prompt; Third: When the focus is lost, the verification of the success of the prompt, the fourth: The loss of focus, validation failure error prompts.
Supports the automatic build hint layer. can be accurately positioned.
Supports custom error message information.
Supports control of character length, range of values, number of selections. Value ranges support numeric and character types; the number of selections supports radio/checkbox/select three kinds of controls
Supports comparisons of 2 control values. You can now compare strings and numeric types.
Server-side checksums are supported.
Supports validation of input formats.

3. jQuery Formvalidator Plugin API help document
Please click here for help documentation

4. Download API help, source code, sample
Http://xiazai.jb51.net/jslib/formValidator2.4.rar
Http://xiazai.jb51.net/jslib/formValidator3.1.rar

Verifying Code Upgrades


5. Sample Code

<script type= "Text/javascript" >
$ (document). Ready (function () {
$.formvalidator.initconfig ({onerror:function () {alert ("checksum does not pass, see error Prompt"}});
$ ("#test1"). Formvalidator ({onshow: "Please enter username", onfocus: "User name at least 6 characters, up to 10 characters", Oncorrect: "Congratulations, you lost the right"}). Inputvalidator ({min:6,max:10,onerror: "The username you entered is illegal, please confirm"});

$ ("#test2"). Formvalidator ({onshow: "Please choose your hobbies (at least 3, choose up to 5)", onfocus: "You choose at least 3, up to 5", Oncorrect: "Congratulations, you picked the right"}. Inputvalidator ({min:3,max:5,onerror: "You choose the wrong number (at least 3, choose up to 5)"});

$ ("#test3"). Formvalidator ({onshow: "Please choose your hobby (at least one)", onfocus: "You choose at least 1", Oncorrect: "Congratulations, you picked the right"}. Inputvalidator ({min:1,onerror: "You choose the wrong Number"});

$ ("#xueli"). Formvalidator ({onshow: "Please choose your degree", onfocus: "Education must Choose", Oncorrect: "Thank you for your cooperation"}). Selectvalidator ({onerror: "You have not forgotten to choose a degree!"});

$ ("#password1"). Formvalidator ({onshow: "Please enter password", onfocus: "Two times password must be consistent Oh", Oncorrect: "Password Consistent"}). Inputvalidator ({min:1,onerror: "Password cannot be blank, please confirm"}). CompareValidator ({desid: "Password2", Operateor: "=", OnError: "2 times password inconsistent, please confirm"});

$ ("#nl"). Formvalidator ({onshow: "Please enter the age between 1-99 years)", onfocus: "Can only enter the number between 1-99 Oh", Oncorrect: "Congratulations, you lost the right"}. Inputvalidator ({min:1,max:99,type: "value", OnError: "Age must be between 1-99, please confirm"});

$ ("#aiguo"). Formvalidator ({onshow: "Patriotic people must choose Oh", onfocus: "You have to seriously think Oh", Oncorrect: "Do not know you love not love, anyway you are elected"}). Inputvalidator ({min:1,max:1,onerror: "Aren't you patriotic?) YOU choose!!!! for me. "});

$ ("#shouji"). Formvalidator ({empty:true,onshow: "Please enter your mobile number, can be empty Oh", onfocus: "If you enter, you must enter the correct", Oncorrect: "Thank you for your cooperation", Onempty: "You really do not want to leave the phone number ah?" "}). Inputvalidator ({min:11,max:11,onerror: "The mobile number must be 11 digits, please confirm"}). Regexvalidator ({regexp: "^[1][0-9]{10}$", OnError: "You entered the phone format is not correct"});

$ ("#lxdh"). Formvalidator ({empty:true,onshow: "Please enter your contact number, can be empty Oh", onfocus: "If you enter, you must enter the correct, format for example: 0577-88069620", Oncorrect: "Thank you for your cooperation," Onempty: "You really don't want to leave the phone number?" "}). Regexvalidator ({regexp: "^[[0-9]{3}-|\[0-9]{4}-]?" ( \[0-9]{8}| [0-9] {7})? $ ", OnError:" You entered the contact phone format is not correct "});

$ ("#ms"). Formvalidator ({onshow: "Please enter your description", onfocus: "Describe at least 10 characters or 20 characters", Oncorrect: "Congratulations, you lost the right"}). Inputvalidator ({min:20,onerror: "The description you entered is not correct, please confirm"});
});
</script>


6. Special Notes

If you encounter any problems in the use of the process, please give me a message, found that the bug please do not modify it, please leave a message, to achieve the purpose of perfect plug-ins, the real service of each program developers.
Please keep the copyright statement of the plugin, thank you

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.