Jquery formvalidator Form Verification plug-in is open-source !! Including API help, source code, and examples

Source: Internet
Author: User

Plug-in home page: http://www.yhuan.com/help posts, each post Bing

Upgrade history

QQ chat group: 74106519

 

2011/5/22 jquery formvalidator 4.0.1 ver

Standardized plug-in naming:
1. All function-related attributes of the plug-in are named in the camel style, that is, the first letter is lowercase, And the other words are capitalized. This change is big. We hope you will understand it to standardize the plug-in name.
2. When all the demos reference the jquery class library, the class library is directly followed by the version number, indicating the maximum class library version supported by the plug-in.

 

Add the following features to the ajaxvalidator function:
1. After page rollback is solved, the control gets the focus and does not make any changes. After the focus is lost, it is forcibly verified.
2. The default value of the Ajax parameter formvalidator (whether to submit to the server) is false, but the control of ajaxvalidator is unconditionally submitted to the server.
3. Add a random number after the URL. Name: Rand
4. Data is being verified on the server before submission. submission is not allowed. If ajaxvalidator verification is triggered before you click the submit button, it is not allowed by default during submission. You can customize the error message and configure parameters in the initconfig function (submitafterajaxprompt, the default value is "data is being verified on the server. Please wait ")
5. If a control is not verified at a time and contains the ajaxvalidator check before clicking submit, the control will be automatically triggered and the submission will be triggered again after the asynchronous return is successful.

 

Other additions and modifications:
1. Modify the error event in initconfig. The output sequence of the errorlist parameter is the same as that of the control. If it is correct, the value of the corresponding position is null.
2. added the submitbuttonid parameter to initconfig, which indicates the ID of the button that triggers verification. If formid is configured, formid takes precedence.
3. If the parameters (validatorgroup) of the reloadautotip, resettipstate, and pageisvalid functions are null, the parameter is processed as "1" by default.
4. Delete the triggervalidate function.
5. inticonfig adds the iniframe attribute to indicate whether the page is embedded in IFRAME. The default value is false.
6. In alertmessage mode, errors are automatically fixed by default, that is, automodify = true
7. add questions in the FAQ
8. Modify user manual
9. Add an example of 2 to select 1 in demo1 and a sample of displaying errors in a centralized manner;
10. Use the submitbuttonid attribute for trigger submission in demo2

Solve the following bugs:
1. regeexvalidator: An invalid character entered after the first verification is passed.
2. After the upgrade, the "full-width character as one length" button in demo1 fails.
3. fixed the problem of resetting all retsettipstate to onshow. Some of the items passed by default at the beginning
4. solve the issue of the control that is bound with ajaxvalidator verification. After the page is rolled back, the control gets the focus without any modification. If the focus is lost, the verification error occurs.
5. resolve the question of automatically creating a prompt to show the full team in the upper left corner. For details, see demo6.html embedded in demo.html.CodeCall

 

 

For more update records, clickHere


1. On-site demonstration

Http://www.yhuan.com/formvalidator/demo1.htm

 

2. Main Functions of the jquery formvalidator plug-in

 

    1. Supports verification of all types of client controls
    2. Supports all the selector Syntax of jquery, as long as the control has a unique ID and type attribute
    3. Supports expansion of functions and regular expressions. The extension library formvalidatorreg. JS is provided. You can add and modify the content freely.
    4. Two verification modes are supported. First: Text prompt (showword mode); Second: pop-up window prompt (showalert Mode)
    5. Multiple Validation groups are supported. If a page has multiple submit buttons and you have to submit them separately, you must perform different verification before submitting them. Therefore, you must use the verification group function.
    6. Supports information prompting in four states, allowing you to flexibly control whether or not four States are displayed. First: prompt when you open the webpage; Second: prompt when you get the focus; Third: prompt when the focus is lost, and fourth: error message indicating verification failure when the focus is lost.
    7. Supports automatic creation of the prompt layer. Can be precisely located.
    8. Supports custom error message.
    9. Supports control of character length, value range, and number of selections. The value range supports the numeric, numeric, and date types. The selected number supports three controls: radio, checkbox, and select.
    10. Comparison of Two control values is supported. Currently, you can compare string, numeric, and date types.
    11. Server-side verification is supported.
    12. Supports validation of input formats.
    13. Supports skin replacement

 

3. jquery formvalidator plug-in API help document

Click here for help documentation


4. Download API help, source code, and examples

Http://files.cnblogs.com/wzmaodong/formValidator4.0.1.zip


5. Sample Code

<SCRIPT type = "text/JavaScript">
$ (Document). Ready (function (){
$. Formvalidator. initconfig ({onerror: function () {alert ("check failed. For details about the error, see the error prompt ")}});
$ ("# Test1 "). formvalidator ({onshow: "Enter the user name", onfocus: "The user name must be at least 6 characters and a maximum of 10 characters", oncorrect: "Congratulations, you have entered the correct information "}). inputvalidator ({min: 6, Max: 10, onerror: "The user name you entered is invalid. Please confirm "});

$ ("# Test2 "). formvalidator ({onshow: "Please select your hobbies (at least three, up to five)", onfocus: "You should select at least three, up to five ", oncorrect: "Congratulations, you selected it "}). inputvalidator ({min: 3, Max: 5, onerror: "The number you selected is incorrect (at least three, up to five )"});

$ ("# Test3 "). formvalidator ({onshow: "select at least one of your hobbies.", onfocus: "select at least one.", oncorrect: "congratulations, you have selected "}). inputvalidator ({min: 1, onerror: "The number you selected is incorrect "});

$ ("# Xueli "). formvalidator ({onshow: "select your education level", onfocus: "education level required", oncorrect: "Thank you for your cooperation "}). selectvalidator ({onerror: "Have you forgotten your degree! "});

$ ("# Password1 "). formvalidator ({onshow: "enter the password", onfocus: "The two passwords must be consistent", oncorrect: "consistent passwords "}). inputvalidator ({min: 1, onerror: "The password cannot be blank. Please confirm "}). comparevalidator ({Desid: "password2", operateor: "=", onerror: "Two different passwords, please confirm "});

$ ("# Nl "). formvalidator ({onshow: "Enter the age between 1 and 99 years old)", onfocus: "Only numbers between 1 and 99 can be entered.", oncorrect: "congratulations, you entered the correct "}). inputvalidator ({min: 1, Max: 99, type: "value", onerror: "The age must be between 1 and 99. Please confirm "});

$ ("# Aiguo "). formvalidator ({onshow: "patriotic people must select Oh", onfocus: "You have to think carefully", oncorrect: "I don't know if you love or not, you chose "}). inputvalidator ({min: 1, Max: 1, onerror: "Aren't you patriotic? Select for me !!!! "});

$ ("# Shouji "). formvalidator ({empty: True, onshow: "Enter your mobile phone number. It can be blank.", onfocus: "If you have entered the phone number, you must enter it correctly.", oncorrect: "Thank you for your cooperation", onempty: "Do you really want to leave a mobile phone number? "}). Inputvalidator ({min: 11, Max: 11, onerror: "the mobile phone number must be 11 digits. Please confirm "}). regexvalidator ({Regexp: "^ [1] [0-9] {10} $", onerror: "Your entered mobile phone format is incorrect "});

$ ("# Lxdh "). formvalidator ({empty: True, onshow: "Enter your contact number. It can be blank.", onfocus: "If you have entered it, you must enter it correctly. The format is as follows: 0577-88069620 ", oncorrect:" Thank you for your cooperation ", onempty:" Do you really want to leave a contact number? "}). Regexvalidator ({Regexp:" ^ [[0-9] {3}-| \ [0-9] {4}-]? (\ [0-9] {8} | [0-9] {7 })? $ ", Onerror:" the contact number format you entered is incorrect "});

$ ("# Ms "). formvalidator ({onshow: "Enter your description", onfocus: "The description must contain at least 10 or 20 characters." oncorrect: "congratulations, you entered the correct "}). inputvalidator ({min: 20, onerror: "The length of the description you entered is incorrect. Please confirm "});
});
</SCRIPT>

6. Special Instructions

If you encounter any problems during use, please leave a message to me. If you find any bugs, please do not modify them by yourself. Also, please leave a message to improve the plug-in and truly serve everyProgramDeveloper.
Please keep the copyright statement of the plug-in. 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.