No stranger to form verification. There are too many validation frameworks on the market, and there is no shortage of excellent products. The younger brother is also releasing a small plug-in open source. There is no other purpose to share the results with you.
First, let's talk about the reason for writing this plug-in. Recently, we have worked with a company on a project. The partner company uses DWR to interact with the background. However, DWR cannot use some mature jquery validation plug-ins on the market. Most of these plug-ins are fixed Ajax submission methods that encapsulate Ajax calls. In this case, too much autonomy is missing. I must use a fixed method in the plug-in. For DWR .. There is no URL call method .. It cannot be used. And. Sometimes we will encapsulate our own Ajax functions and perform other JS processing after the request and callback. Some frameworks on the market are too comfortable for us. Configuration is too troublesome .. Write Js .. You need to write a lot of configuration items .. (PS: it may also be simple and convenient. But I did not find it. If yes, you can leave a message and recommend it)
So the younger brother is not talented. I have researched and written a set of small plug-ins. Recently, I have been adjusting the CSS style and some beautification and subsequent improvements ..
I personally think this plug-in is very convenient and easy to configure. Directly write the corresponding parameters in HTML. You can.
Example: HTML code
- <Input type = "text" id = "inputtext" check-type = "required"
- Min-max = "3-5" Min-message = "the character length cannot be less than 3 characters"
- Max-message = "a maximum of five characters can be entered"
- Required-message = "text cannot be blank! ">
This is a text check whether it is null, the input length is 3-5 characters.
Check-type: Check type
Required-message: prompt message
Min-max; minimum and maximum characters
Currently, the following types of check-type are supported:
Required: cannot be empty
Number: numeric type
Mail: email address verification
CHAR: Must be an English character
Chinese: it must be a Chinese character
Mobile: Mobile Phone number verification
Password: Password Strength Verification
Confirmpwd: Confirm Password
Dateymd: Date Format
Idcard: ID card number
Ii. frontend call method:
In order to achieve lightweight, simple, and convenient front-end calling, simple JS Code
- <SCRIPT>
- $ (Function (){
- $ ('# Form'). myvalidate ("subbtn", function (){
- Callbackfunction ();
- });
- });
- // In this function, we can perform any operation we want to perform. Includes custom encapsulated Ajax Methods
- // Completely abandon the limitations of the regular Ajax verification rules of other verification frameworks
- Function callbackfunction (){
- Alert ("callback function ");
- }
- </SCRIPT>
Below is:
2
3