Twitter bootstrap form validation

Possible duplicate:
How to use Twitter bootstraps for jQuery validation notifications?

Trying to use bootstrap styles to validate form.

I use this javascript validator that was configured to load: https://github.com/ddarren/jQuery-Live-Form-Validation-For-Twitter-Bootstrap

In the head:

<link href="bootstrap.css" rel="stylesheet"> <script src="jquery.validate.js" type="text/javascript"> 

In body:

  <form id="Form" action="" method="post"> <div class="control-group"> <input type="text" class="span3" id="Mobile" placeholder="Mobile Phone Number" name="Mobile"> </div> <div class="control-group"> <button type="submit" class="btn btn-primary btn-large">Submit </button></p> </div> </form> 

And it does not highlight fields using bootstrap error styles. Any ideas I'm wrong about? Thanks in advance.

+19
validation twitter-bootstrap forms
Mar 15 2018-12-12T00:
source share
1 answer

I am working on something similar, so I think I can help you. First of all, the jQuery-Live-Form-Validation-For-Twitter-Bootstrap library is quite old (September 2009).
It uses version 1.3.2 of jQuery (the latest version is 1.7.1), and it does not use Bootstrap source files at all!
If you downloaded jQuery-Live-Form-Validation-For-Twitter-Bootstrap (which I'm sure you did) from the github site, you can easily check css that there are two css files written by the author of this library.
Answering your question, I downloaded this library and I pasted your code and ... it works.
You just need to have this in your head (and these files in folders):

 <link rel="stylesheet" type="text/css" href="stylesheets/jquery.validate.css" /> <link rel="stylesheet" type="text/css" href="stylesheets/style.css" /> <script src="lib/jquery/jquery-1.3.2.js" type="text/javascript"> </script> <script src="javascripts/jquery.validate.js" type="text/javascript"> </script> 

which is originally taken from jQuery-Live-Form-Validation-For-Twitter-Bootstrap .
If you really want Twitter bootstrap form validation using jQuery , I would recommend that you use the combined Twitter Bootstrap and jQuery validation plugin .
I am working on it now and it works great.

+26
Mar 16 '12 at 19:23
source share



All Articles