One of the great strengths of yii2 is his form component, which is both convenient and safe. Some small partners feel with Yii for a period of time, good, except than TP "difficult to understand" like nothing. Leadership arrangements to engage in a registration function, this guy brushes brush is Baidu what what good form style, is Baidu what what what validate verification, really for this guy pinch sweat. Of course, in front of the nonsense, our foc
Deep Learning about jQuery Validate form verification, jqueryvalidate
This article introduces jQuery Validate form verification, mainly by using jquery. metadata. js directly writes verification rules in the class attribute and defines the error message. The content is as follows:
1. Add another plug-in jquery. metadata. js and write the validation rules in the control.2. You need to rewrite the method that
may wish to take a look at this article.But what do we do with the page that the front desk user registers? This is the main content of this article, we can use jquery Validate plug-in to do registration verification function, jquery I have no system to learn, just use what to learn what, what to understand, so if there is a mistake, please comment ~ Below I step-by-step through the code to explain the use of jquery-
Jquery Validate Related parameters
Define Chinese message
var cnmsg = {
Required: "Required fields",
remote: "Please correct this field",
email: "Please enter the correct format email",
URL: "Please enter a valid URL" , date
: "Please enter a valid date",
dateiso: "Please enter a valid date (ISO).",
Number: "Please enter the valid numbers",
digits: "Only integer",
CreditCard: "Please enter a valid credit card number",
equalto: "Please enter th
previous operation is successful, an error occurs when the task is executed immediately, the error rate is high.
After studying for a long time, I could not find the problem, and I did not trigger any verification.CodeLater, I overwritten the page. Validate () method and set breakpoint monitoring for it:
After clicking submit, it is often executed after the page and all the load functions of the control are executed, rather than the listviewdo
Use jquery in the previous article. in validate for client verification (intermediate>), I introduced jquery. the three verification methods of validate. In this article, we will continue to introduce jquery based on the previous one. some common verification methods of validate.
Today, we will introduce the problems that will occur after jquery.
//Validate option ***********************************************************$ ("form"). Validate ({debug:true //debug mode (form not submitted)rules:{Name:"Required",//custom rule, key:value form, key is the element to be validated, value can be a string or an objectemail:{//built-in authentication methodRequiredtrue,//Required FieldsRequired: "#aa: Checked"If the value of the expression is true, the requ
The jQuery Validate Form Verification plug-in adds the class attribute Form validation, jqueryvalidate
This article introduces the jQuery Validate Form Verification plug-in, and adds the class attribute Form Verification for your reference. The details are as follows:The effect is as follows:
I. jQuery Form Verification plug-in, adding class attribute Validation
Ii. default rulesDefault verification rules
Transferred from: http://asialee.iteye.com/blog/2001239Validate Option ***********************************************************$ ("form"). Validate ({ Debug:true//debug mode (form not submitted) rules:{ Name: "Required",//Custom rule, key:value form, key is the element to be validated, value can be a string or an object email:{//built-in authentication method Required:true,//required fields Required: "#aa: Checked" expression with a value of tr
See http://docs.jquery.com/plugins/validationand sort out
Jquery. validate. JS is a verification framework of jquery. With the advantages of jquery, we can quickly verify some common input, expand our own verification methods, and provide good support for internationalization.
It's easy to use this function. See the following code:HTML code
Http://www.w3.org/TR/html4/loose.dtd>
Today, we found that jquery still has the jquery validate feature, which can be used to verify the form. Below is a review and summary:
1. Use jqueryvalidate. js.
Http://bassistance.de/jquery-plugins/jquery-plugin-validation/
2. Example
Note: Adding required to the class in the input field is required. The others are verification data. For example, email is the verification data structure.
The following lists the default verification items provide
STRUTS2 provides us with a good data validation framework –validate, which can easily implement data validation on the server side. ActionSupport类提供了一个validate()方法,当我们需要在某一个action中进行数据验证时,可以重写这个方法。数据验证往往是在客户端向服务端提交表单信息时进行的,比如execute方法负责处理表单信息并返回相应的结果,在此之前,validate会先对提交的表单信息进行验证:Validation Pass: The appropriate action for execute is performed.Authentication failed
I have reprinted an article written by my predecessors and modified it for record only.First paste the code of a major Chinese company:Copy codeThe Code is as follows: I started from this example. In fact, this example almost contains the essence of jquery. validate. js. If you fully understand this code, it is basically an entry point.I think that when I used to simulate futures web pages online, I wrote my own code to judge them. They were actually
Jquery. validate Form Verification plug-in uses the method to parse why jquery validate Form Verification plug-in is used: it is not easy to write a general and powerful jquery Form Verification plug-in. Jquery validate is a jquery plug-in that can easily handle Form Verification for more than 95%. The specific content is as follows:
Usage
1. Use the default ver
This is one of the problems encountered in the work today. Because the business needs to add a new check logic when the original form is submitted.The original logic is as follows (the code is Simplified):When a form is submitted, the check method is used to verifyformonsubmit="return check ();"> method Code:function Check () {if(...) {alert ("xxx");returnfalse;}} because a new logic is added, I have added a new method that adjusts the structure of the code:formonsubmit="return Newcheck ();"> me
Jquery. Validate. js Form validation this article is transferred from: http://hi.baidu.com/greenandcoffee/blog/item/5ebe5850e2cfbb551138c24d.html
I. PrerequisitesHttp://bassistance.de/jquery-plugins/jquery-plugin-validation/API: http://jquery.bassistance.de/api-browser/plugins.htmlCurrent version: 1.5.5Jquery version: 1.2.6 +, compatible with 1.3.2Ii. Default verification rules(1) required: required field for true(2) Remote: "check. php" uses
Use jquery. validate, jqueryvalidate
Introduction to jquery. validateI haven't written JavaScript for several years, and the data is slowly organized and the format is also messy.Mainly divided into several partsJquery. validate basic usageJquery. validate API descriptionJquery. validate customJquery.
. Format ("enter a minimum value of {0 ")
}); Recommended Practice: Put this file into messages_cn.js and introduce it on the page
Usage
1. Write the validation rule to the control.
$ (). Ready (function (){
$ ("# Signupform"). Validate ();
});
Class = "{required: True, minlength: 5, messages: {required: 'Enter the content'}" when using the sort to keyword, the following content must be enclosed by quotation marks, the following code:C
By default, the label element is used to display the verification prompt information and CSS class is added, CSS allows you to easily set error controls and display methods of error messages. /* Input control verification error */form input. error {border: solid 1px red;}/* verification error message */form label. error {width: 200px; margin-left: 10px; color: red;} to customize the display mode, you can modify jquery. by default, the error message is displayed by label in
"),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 follows:$ (). Ready (function (){$ ("# SignupForm"). validate ();});// --> To use class =
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.