The effect of the chart is as follows:
Instructions for use
Need to use jquery library file and formvalidation library file [download instance code]
http://jquery.com/
You also need to customize the CSS style to display a hint error message
working with Instances
One, including the file section
Copy Code code as follows:
<script src= "Jquery.js" type= "Text/javascript" ></script> <script src= "Jquery.validationEngine.js" Type= "Text/javascript" ></script> <link rel= stylesheet "href=" ValidationEngine.jquery.css "type=" text/ CSS "media=" screen "/>
two, HTML section
Copy Code code as follows:
<input class= "validate[required,custom[onlyletter],length[0,100]]" name= "FirstName" type= "text"/>
The form authentication method for the Formvalidation plug-in is as follows:
VALIDATE[REQUIRED,CUSTOM[ONLYLETTER],LENGTH[0,100]] Parameter description: Required indicates that the form is required, custom[] represents the condition of validation, length represents
Formvalidation Plug-in Additional instructions:
Optional:special: case where the form value is not empty
Required: Must clay
LENGTH[0,100]: Length Range
MINCHECKBOX[7]: Minimum check box number
Confirm[fieldid]: Matching other fields (such as: Confirm password)
Telephone: Matching phone number rule
Email: matching e-mail rules
Onlynumber: Matching number rules
Nospecialcaracters: Matching character rules
Onlyletter: Matching Letter Rules
Date: Match YYYY-MM-DD format
Formvalidation Plug-in Application example
First, verify the Radio box
Copy Code code as follows:
<input class= "validate[required] Radio" type= "Radio" name= "Radiogoupe" value= "5" > <input class= "validate[ Required] Radio "type=" Radio "name=" Radiogoupe "value=" 3 "/> <input class=" validate[required] Radio "type=" Radio " Name= "Radiogoupe" value= "9"/>
Two, verify check box
Copy Code code as follows:
<input class= "validate[mincheckbox[2]" checkbox "type= checkbox" Name= "Checkboxgroupe" value= "5" > <input Class= "validate[mincheckbox[2]" checkbox "type=" checkbox "Name=" Checkboxgroupe "value=" 3 "/> <input class=" VALIDATE[MINCHECKBOX[2]] checkbox "type=" checkbox "Name=" Checkboxgroupe "value=" 9 "/>
Third, verify the dropdown box
Copy Code code as follows:
<select name= "Sport" id= "Sport" class= "validate[required]" > <option value= "1" >biuuu_1</option> <option value= "2" >biuuu_2</option> <option value= "3" >biuuu_3</option> <option value= "4" >biuuu_4</option> </select>
Four, verify the telephone number
Copy Code code as follows:
<input class= "Validate[required,custom[telephone]] text-input" type= "text" name= "Telephone"/>
Five, verify the mailbox
Copy Code code as follows:
<input class= "Validate[required,custom[email]] text-input" type= "text" name= "email" id= "email"/>
As above example, using the Formvalidation plug-in to implement form verification method is relatively simple, mainly in its implementation of personalized error prompts, and can customize the matching rules, as follows:
"Telephone": {"regex": "/^[0-9-()]+$/", "Alerttext": "* Invalid phone Number"}, where the regex represents the matching rule
This allows you to implement custom form error prompt text using Alerttext, which is the same as using the validation plug-in, and it is recommended that you use the jquery form validation plug-in formvalidation implement personalized error prompts.
File package Download