Bootstrap Validator form Verification _javascript Tips

Source: Internet
Author: User
Tags button type

Online Demo Address:http://www.shouce.ren/study/api/s/jq--BootstrapValidator--index.html

Using the method, the code looks like this:

1.<form id= "Defaultform" method= "post" class= "Form-horizontal" action= "target.php" > 2. <div class= "Form-group" > 3. <label class= "col-lg-3 Control-label" > Username </label> 4. <div class= "Col-lg-5" > 5. <input type= "text" class= "Form-control" name= "username"/> 6. </div> 7. 
</div> 8. 9. <div class= "Form-group" > 10. <label class= "Col-lg-3 control-label" > Mailbox </label> 11. <div class= "Col-lg-5" > 12. <input type= "text" class= "Form-control" name= "email"/> 13. </div> 14. 
</div> 15. <div class= "Form-group" > 17. <label class= "col-lg-3 control-label" > Birthday </label> 18. <div class= "col-lg-5" > 19. <input type= "text" class= "Form-control" name= "Birthday"/> (yyyy/mm/dd) 20. </div> 21. 
</div> 22. <div class= "Form-group" > 24. <div class= "Col-lg-9 col-lg-offset-3" > 25. <button type= "Submit" class= "btn btn-primary" name= "signup" value= "Sign" Up "> Submit </button> 26. <button type= "button" class= "btn btn-info" id= "VALIDATEBTN" > Automatic validation </button> 27. <button type= "button" class= "btn btn-info" id= "resetbtn" > Reset Form </button> 28. </div> 29. </div> 30.</form> 1.$ (' #defaultForm '). Bootstrapvalidator ({2. Message: ' It's not valid ', 3. feedba Ckicons: {4 valid: ' Glyphicon glyphicon-ok ', 5. Invalid: ' Glyphicon glyphicon-remove ', 6 validating: ' Glyphicon glyp Hicon-refresh ' 7. }, 8. Fields: {9 username: {. Message: ' The username isn't valid ', validators: {notempty: {A. Message: ' Th E username is required and cannot are empty ' 14. }, 15. Stringlength: {min:6, max:30, message: ' The username must is more than 6 and less than characters Lon G ' 19. }, 20. RegExp: {regexp:/^[a-za-z0-9_\.] +$/, 22. Message: ' The username can only consist of alphabetical, number, dot and underscore ' 23. }, 24. Remote: {A. URL: ' remote.php ', 26. Message: ' The username isn't available ' 27. }, 28. 
Different: {The field: ' Password ', message: ' The username and password cannot is the same as each other ' 31.} 32.} 33. }, 34. 
Email: {validators: {emailaddress: {38. Message: ' The input is not a valid e-mail address '.} 39.} 40. }, 41. } 42.});

The above is a small set to introduce the Bootstrap Validator form verification of all the narration, hope to help everyone, if you want to learn more content please pay attention to cloud habitat community!

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.