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.