basic.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <!-- Gives example of basic form -->
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <title>BootstrapValidator demo</title>
  6. <link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css"/>
  7. <link rel="stylesheet" href="../dist/css/bootstrapValidator.css"/>
  8. <script type="text/javascript" src="../vendor/jquery/jquery-1.10.2.min.js"></script>
  9. <script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
  10. <script type="text/javascript" src="../dist/js/bootstrapValidator.js"></script>
  11. <!-- Support datetime picker plugin: http://eonasdan.github.io/bootstrap-datetimepicker/ -->
  12. <link rel="stylesheet" href="//eonasdan.github.io/bootstrap-datetimepicker/content/bootstrap-datetimepicker.css"/>
  13. <script type="text/javascript" src="//eonasdan.github.io/bootstrap-datetimepicker/scripts/moment.js"></script>
  14. <script type="text/javascript" src="//eonasdan.github.io/bootstrap-datetimepicker/scripts/bootstrap-datetimepicker.js"></script>
  15. <style type="text/css">
  16. /* Override to make the feedback icons shown properly */
  17. .form .bv-input-group-icon {
  18. top: 25px;
  19. right: 35px;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div class="container-fluid">
  25. <div class="row">
  26. <div class="col-lg-8 col-lg-offset-2">
  27. <form id="basicExample" action="target.php" method="post">
  28. <div class="row">
  29. <div class="col-lg-1">
  30. <div class="form-group">
  31. <label for="prefix">Prefix:</label>
  32. <input type="text" name="prefix" class="form-control">
  33. </div>
  34. </div>
  35. <div class="col-lg-10">
  36. <div class="col-lg-4">
  37. <div class="form-group">
  38. <label for="firstname">First Name:</label>
  39. <input type="text" name="firstname" class="form-control">
  40. </div>
  41. </div>
  42. <div class="col-lg-4">
  43. <div class="form-group">
  44. <label for="middlename">Middle Name:</label>
  45. <input type="text" name="firstname" class="form-control">
  46. </div>
  47. </div>
  48. <div class="col-lg-4">
  49. <div class="form-group">
  50. <label for="lastname">Last Name:</label>
  51. <input type="text" name="lastname" class="form-control">
  52. </div>
  53. </div>
  54. </div>
  55. <div class="col-lg-1">
  56. <div class="form-group">
  57. <label for="suffix">Suffix:</label>
  58. <input type="text" name="suffix" class="form-control">
  59. </div>
  60. </div>
  61. </div>
  62. <div class="row">
  63. <div class="col-lg-6">
  64. <div class="form-group">
  65. <label for="email">Email:</label>
  66. <input type="email" name="email" class="form-control">
  67. </div>
  68. </div>
  69. <div class="col-lg-6">
  70. <div class="form-group">
  71. <label for="phonenumber">Phone Number:</label>
  72. <input type="text" name="phonenumber" class="form-control">
  73. </div>
  74. </div>
  75. </div>
  76. <div class="row">
  77. <div class="col-lg-12">
  78. <div class="form-group">
  79. <label for="languages">What Programming languages do you use?</label>
  80. <div class="checkbox">
  81. <label>
  82. <input type="checkbox" name="languages[]" value="php"> PHP
  83. </label>
  84. </div>
  85. <div class="checkbox">
  86. <label>
  87. <input type="checkbox" name="languages[]" value="asp"> ASP.NET MVC
  88. </label>
  89. </div>
  90. <div class="checkbox">
  91. <label>
  92. <input type="checkbox" name="languages[]" value="coldfusion"> ColdFusion
  93. </label>
  94. </div>
  95. <div class="checkbox">
  96. <label>
  97. <input type="checkbox" name="languages[]" value="javascript"> JavaScript
  98. </label>
  99. </div>
  100. <div class="checkbox">
  101. <label>
  102. <input type="checkbox" name="languages[]" value="ruby"> Ruby
  103. </label>
  104. </div>
  105. <div class="checkbox">
  106. <label>
  107. <input type="checkbox" name="languages[]" value="python"> Python
  108. </label>
  109. </div>
  110. <div class="checkbox">
  111. <label>
  112. <input type="checkbox" name="languages[]" value="java"> Java
  113. </label>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="row">
  119. <div class="col-lg-12">
  120. <input type="submit" class="btn btn-primary btn-lg pull-right">
  121. </div>
  122. </div>
  123. </form>
  124. </div>
  125. </div>
  126. </div>
  127. <script>
  128. $(function() {
  129. $('#basicExample').bootstrapValidator({
  130. message: 'This value is not valid',
  131. feedbackIcons: {
  132. valid: 'glyphicon glyphicon-ok',
  133. invalid: 'glyphicon glyphicon-remove',
  134. validating: 'glyphicon glyphicon-refresh'
  135. },
  136. fields: {
  137. prefix: {
  138. validators: {
  139. // not required
  140. }
  141. },
  142. firstname: {
  143. validators: {
  144. notEmpty: {
  145. message: 'First Name is required.'
  146. }
  147. }
  148. },
  149. middlename: {
  150. validators: {
  151. notEmpty: {
  152. message: 'Middle Name is required.'
  153. }
  154. }
  155. },
  156. lastname: {
  157. validators: {
  158. notEmpty: {
  159. message: 'Last Name is required.'
  160. }
  161. }
  162. },
  163. suffix: {
  164. validators: {
  165. // not required
  166. }
  167. },
  168. email: {
  169. validators: {
  170. notEmpty: {
  171. message: 'Email is required.'
  172. },
  173. emailAddress: {
  174. message: 'The value is not a valid email address.'
  175. }
  176. }
  177. },
  178. phonenumber: {
  179. validators: {
  180. notEmpty: {
  181. message: 'Phone number is required.'
  182. },
  183. phone: {
  184. country: 'US',
  185. message: 'The value is not a valid US phone number.'
  186. }
  187. }
  188. },
  189. 'languages[]': {
  190. validators: {
  191. notEmpty: {
  192. message: 'You must pick at least one.'
  193. }
  194. }
  195. }
  196. }
  197. });
  198. });
  199. </script>
  200. </body>
  201. </html>