This example describes the jquery validate plug-in functionality and usage. Share to everyone for your reference, specific as follows:
Preface: to form the content format verification, the original JS writing, more cumbersome, the author once wrote a registration interface, verify the mailbox format, user name format, password format, many use the regular, and e
Scenario One: If the project is not just an individual page with multiple name validations,Then use prototype to write, add this code in the JS initialization of the page you want to use multiple nameif ($.validator) {$.validator.prototype.elements = function () {var validator = this,Rulescache = {};Select all valid inputs inside the form (no submit or Reset buttons)return $ (This.currentform). Find ("Input, select, textarea"). Not (": Submit,: RESET,
Implement smart Form Verification Based on jquery, and implement smart forms using jquery
Many website registration modules can check whether the format is correct in real time, which greatly enhances the user experience and is very beneficial to development.The following table is displayed:
1.
Use the jquery selector to get the jquery object of the corresponding form, and then use the attr method to modify the corresponding action. If you need it, refer to the following basic ideas:
Get the jquery object of the corresponding form by
thinkphp form Auto-validate function, thinkphp form verification
Last night, our boss asked me to get the form of automatic verification function, sorrow for a long day borrowed a lot of knowledge of the official website, just out, eh, to share my own results!
Thinkphp in the model base class for us to define the func
This article mainly introduces how to use jquery. form. js implements the Image Upload method, involving jquery using the form plug-in jquery. form. it is very simple and practical to u
When you need to repeat the same thing multiple times, you can find a method that saves time and effort. The following describes how to use the jquery selector to quickly extract web form data, when doing the same thing on the web, you can find a method that saves time and effort when you need to repeat the same thing multiple times.
Before submitting a form on
The 1.action class introduces the Struts2 "Json-default" Interceptor stack@ParentPackage ("Json-default")// Wap_package inherits the Json-default@Namespace ("/")publicclassextends wapbaseaction {...[email protected] The result type is JSON and you can set the params@Action (value = "Creatresume", results = {@Result (name = Json,type=json, Params={root,result})})3.jquery serialized Form
verify the phone number. There's no testing here. Finally, we take a look at the final form validation, the ultimate validation form needs to be added CSS, the following is the complete final validation code.
8. Verify the form full version
8.1 HTML Form
To make the form
JQuery. validate common methods and issues to be aware of. For more information, see 1. use other methods to replace the default SUBMIT.
The Code is as follows:
$ (). Ready (function (){$ ("# SignupForm"). validate ({SubmitHandler: function (form ){Alert ("submitted ");Form
Vee-validate, Vue2.0 form verification component
Vee-validate tutorial
This article is suitable for reference by students who have basic knowledge about Vue2.0 and will be used based on the actual situation of the project. I am also using it while learning. If there are any mistakes, please criticize and point out *
I.
a string with a maximum length of {0}"), minlength: jQuery. validator. format ("enter a string with at least {0} length"), rangelength: jQuery. validator. format ("enter a string between {0} and {1}"), range: jQuery. validator. format ("enter a value between {0} and {1}"), max: jQuery. validator. format ("enter a maxi
-linkbutton" iconCls= "icon-cancel" plain= "true" onclick= "cancelItem( >Cancel Step 4: Save or cancel editsCall the "SaveItem" function to save the user, or call the "Cancelitem" function to cancel the edit. function saveItem(index){ var row = $( ‘#dg‘ ).datagrid( ‘getRows‘ )[index]; var url = row.isNewRecord ? ‘save_user.php‘ : ‘update_user.php?id=‘ +row.id; $( ‘#dg‘ ).datagrid( ‘getRowDetail‘ ,index).find( ‘form‘ ).
form is submitted, a form that has not passed the verification (the first form or a form that has not passed the verification that has received the focus before submission) will get the focusFocuscleanup: Boolean default: falseIf this parameter is set to true, the error message is removed when the unverified element g
"),Range: jQuery. validator. format ("enter a value between {0} and {1 "),Max: jQuery. validator. format ("enter a maximum value of {0 "),Min: jQuery. validator. format ("enter a minimum value of {0 ")});We recommend that you add this file to messages_cn.js and introduce it on the page.
Iv. Usage1. Write the validation rule to the control.Copy codeThe Code is as
value must be the same as #field.
11
Accept
Enter a string with a valid suffix name (the suffix of the upload file).
12
Maxlength:5
Enter a string with a maximum length of 5 (Chinese characters are counted as one character).
13
Minlength:10
Enter a string with a minimum length of 10 (Chinese characters are counted as one character).
14
RANGELENGTH:[5,10]
Enter a string that must be between 5 and 10 (
Customize the validation behavior of jquery-validate
1: custom form submission
Set submitHandler to customize the form submission action
$ (". Selector"). validate ({
SubmitHandler: function (form) {alert ("verified ");}
});
To
Form Verification is the most common in daily projects. Using a good JS library can help us get twice the result with half the effort. Jquery. Validate is undoubtedly a good choice.
Jquery. validate. This verification library is a
JQuery Validation PluginAdvantages:1. Form validation is simple and convenient, and many configuration items are available2. Internationalization, you can customize the prompt informationCommand-line InstallationInitialize BowerBower InitInstalling jquery using BowerBower Install j
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.