Read about jquery multi step form with validation, The latest news, videos, and discussion topics about jquery multi step form with validation from alibabacloud.com
Form validation is frequently encountered during web site development, and can be validated using server-side language, or by using the client language. This article introduces you to a simple example of the jquery client validation form. Examples are for reference only.
1. Introduction of jquery Plugin (jquery dependent)
2. Define the validation rulesThe key is the name of the label$ (function () {$ ("#myform"). Validate ({rules:{"username": {"required": true, "Checkusername":true},3. Define error label StyleThe plugin automatically finds the first tag that matches the name= "xxx" and adds an error tag after it (c
.
Creditcard:true
You must enter a valid credit card number
Equalto: "#field"
The input value must be the same as #field
Accept
Enter a string with a valid suffix name (the suffix of the upload file).
Maxlength:5
Enter a string with a maximum length of 5 (Chinese characters are counted as one character).
Minlength:10
Enter a string with a minimum length of 10 (Chinese characters are counted as one char
requires validation
Two of the elements that are commonly used in the form that need to be filled in or not filled in at the same time
Common methods and attention problems
1. Replace the default submit in other ways
Copy Code code as follows:
$ (). Ready (function () {
$ ("#signupForm"). Validate ({
Submithandler:function (form) {
Alert ("
One, download the dependency packageNET disk Download: Https://yunpan.cn/cryvgGGAQ3DSW access password f224Second, add a separate plugin jquery.validate.messages_cn. js.Change the default prompt mode.Third, jquery form validation plug-in----by the Name property to correlate fields to verify that Officer rules are written into the JS code. for= "Cusername" > Name
This article is about PHP form validation corresponding to the Jquery-validate plug-in, has a certain reference value, now share to everyone, the need for friends can refer to
Direct code. If you do not understand the parameters, you can refer to the Jquery-validate plugin
Learning Recommendations:"THINKPHP5 Classic
Objective
This problem after my collation found that the knowledge of the event and JS structure did not understand clearly, return false in the onclick event did not return, so onclick after just showing the false value.
Workaround Example
is a common form validation submission:
checkUserInfo()is a jquery authentication method, error return false .
validation rule
age:{
Required: "Age cannot be empty",
Range: "Age must be between 26 and 50"
},
Edu: "Choose at least one degree",
birthday:{
Required: "Date of birth cannot be empty",
Dateiso: "Birth date format is incorrect"
},
email:{
encountered some problems:
This is how the form started, and the Validtype attribute is written in the Data-options attribute:
Here is a problem: This write Firebug will be an error, because the #snumbers need to be quoted, but direct quotes will be wrong, here is equivalent to Sanchong quotes, the internet to check a lot of information, some with escape, are not workable, I guess here is the problem of EASYUI resolution, Unless you ch
$ ("#commentForm"). Validate (): On it, what parameters should be added ...
Registration information authentication text message $ (function () {JQuery.validator.addMethod ("IsMobile", function (value, Element) {var length = Val
Ue.length; return this.optional (Element) | | (length = /^ ((13[0-9]{1}) | ( 15[0-9]{1}) | (18[0-9]{1}))
+\D{8}) $/.test (value)); "Please fill in your phone number correctly."
"); Entry into force $ ("#signup-form
following will refer to its role.
4, the application of validation plug-ins
How to invoke the validation plug-in:
code is as follows
copy code
$ (function () { var validate = $ ("#myform"). Validate ({ nbsp; rules:{//define validation rules ... }, messages:{//define hint information ... } }) });
Rules
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.