Bootstrap form validation plug-in Bootstrapvalidator use method collation

Source: Internet
Author: User
Tags button type valid email address validation examples

Plugin Introduction

Let's start with a diagram:


: Https://github.com/nghuuphuoc/bootstrapvalidator

How to use: http://www.cnblogs.com/huangcong/p/5335376.html

Tips for using

Chinese Culture:
After the plugin is downloaded, the \js\bootstrapvalidator\language\zh_cn.js is introduced into the file, which implements the culture

Validate the form before submission:
A richer list of forms validation examples: http://www.jq22.com/yanshi522, directly on the code:

  1 <! DOCTYPE html> 2 

Look at line 331, click Submit, use

$ (' #defaultForm '). Bootstrapvalidator (' Validate ');

Single-Touch publication verification

Here is a pit that comes across:

Bootstrapvalidator The default logic is to turn the button gray when the form validation fails.
However, in the project, the button is not inside the form and is submitted via an event binding to Ajax. So here's the question:

The project needs to not perform the subsequent events that are bound when the form validation fails. Baidu half-day can not find relevant information, finally still rely on Google:

$ ("#yourform"). Submit (function (EV) {Ev.preventdefault ();}); $ ("#submit"). On ("click", Function () {   var bootstrapvalidator = $ ("#yourform"). Data (' Bootstrapvalidator ');   Bootstrapvalidator.validate ();   if (Bootstrapvalidator.isvalid ())     $ ("#yourform"). Submit ();   else return;});

Jiangzi can tell if the form validation has passed.

Transferred from: http://www.cnblogs.com/woodk/p/5546847.html

Bootstrap form validation plug-in Bootstrapvalidator use method collation

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.