Want to know jquery accordion form with validation example? we have a huge selection of jquery accordion form with validation example information on alibabacloud.com
Verify the operation class formvalidatorclass. js
CopyCode The Code is as follows :/**
* @ Author Ming
*/
$ (Document). Ready (function (){
/** // * Set the default attribute */
$. Validator. setdefaults ({
Submithandler: function (form ){
Form. Submit ();
}
});
// Character Verification
Jquery. validator. addmethod ("stringcheck", function (value, element ){
Re
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
Key Features:
Validation of all data before form submission, non-conformance to commit (validate)
If the form check does not pass, auto focus to the first wrong domain
Automatically display error message after control
Support for checksum based on name and Class (Rule,addclassrules)
Remote check-in support (remotes)
Easy to scale: Easily custo
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
This article illustrates the jquery Validate form verification plug-in, how to customize a validation method, share for everyone to refer to, the specific content as follows
The effect is as follows:
Validation failure Effect:
To verify successful results:
Specific steps:
1, the introduction of the dependency
This period of time to work more idle, the total feeling can not let their technology deserted, so again the old line, do a small demo to.
This time I made a JS version of the form verification plug-in, the overall principle of reference to the jquery validate, but in some small areas still have their own innovation.
The main features of this plugin are the following.
1.
1, first need to import JS package and CSS Package: http://download.csdn.net/detail/l294333475/78169512. index.jsp (Test page)Validate.js: (Can be modified according to their own requirements)$ (document). Ready (function () {/** * acknowledgement information validation */jquery ("#checkInfoForm"). Validationengine ();/** * Custom Information validation *
JavaScript Form Validation Regular expression encyclopedia
Using regular expressions to determine whether the Arabic numerals are 0-9
Copy Code code as follows:
function Regisdigit (fdata)
{
var reg = new RegExp ("^[0-9]$");
Return (Reg.test (fdata));
}
Use this expression to get the length of the string
Copy Code code as follows:
function Regdatalength (fdata
The examples in this article describe the usage of PHP common form validation classes. Share to everyone for your reference. as follows:
I hope this article will help you with your PHP programming.
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:{
The latest updates have been modified when the input component name is included []. The focus on the component will appear JS error, only IE is the case, did not find a good solution, I just to exclude this situation, that is, when the component name contains [] does not focus on moving up, Please contact me for any good solution.
and made a demo8--combining jquery to implement AJAX custom validation
Do
less than the set value, you can make a precise prompt.
Comparevalidator:The value range of the two form elements (numeric and numeric)
Regexvalidator:Validate the format of input values. You can write regular expressions by yourself, or use the regular expressions of the extension library.
Ajaxvalidator:Verify the value entered by the user on the server. For example, whether a user exists
Function
WordPress, of course, there are forms of verification, but we all know that the user experience is not good, the page jumps, and sometimes the form will be emptied, and the front desk form certification seems very necessary. The following is my written by changing the text box background color prompts the user input content, WordPress as long as the following code into the JS file can work. The
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
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.