Javascript-question about bootstrap form verification

Source: Internet
Author: User
The bootstrap set in the background can satisfy most of the style requirements. there is a form submission problem, which sets the template provided by the existing bootstrap. The code is as follows & amp; lt; divclass & quot; container & quot; & amp; gt; {code ...} there is no introduction to the form verification method on the official website. we know that re... the bootstrap set in the background can satisfy most of the style requirements. there is a form submission problem, which sets the template provided by the existing bootstrap. The code is as follows:

  

There is no description on the official website about the form verification method. I know what require means, but I want to know where to find the introduction to this aspect. I cannot find it on the official website. Thank you!

Because I wrote ajax asynchronous commit, it is difficult to make it. I want to use the built-in bs verification form for asynchronous submission. Thanks

Reply content:

The bootstrap set in the background can satisfy most of the style requirements. there is a form submission problem, which sets the template provided by the existing bootstrap. The code is as follows:

  

There is no description on the official website about the form verification method. I know what require means, but I want to know where to find the introduction to this aspect. I cannot find it on the official website. Thank you!

Because I wrote ajax asynchronous commit, it is difficult to make it. I want to use the built-in bs verification form for asynchronous submission. Thanks

Simple.

$("form").submit(function(e){    e.preventDefault();   // disabled default action    // do something and ajax ....    $.post("url", $("form").serializeArray())    .done(function(){})    .failed(function(){})      });

Before submitting the form data to ajax for processing, you can write a function to verify the data first and then hand it over to ajax. if it fails, a prompt message is returned.

Enter the server address of the action in the form tag.

I searched for it on github, there are a lot of, pick your own https://github.com/search? Utf8 = % E2 % 9C % 93 & q = Bootstrap + Validator

Can see this page, jQuery Validate | Cainiao tutorial http://www.runoob.com/jquery/jquery-plugin-validate.html

Plug-ins can help you do this.

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.