defaultMessage.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>BootstrapValidator demo</title>
  5. <link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css"/>
  6. <link rel="stylesheet" href="../dist/css/bootstrapValidator.css"/>
  7. <script type="text/javascript" src="../vendor/jquery/jquery.min.js"></script>
  8. <script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
  9. <script type="text/javascript" src="../dist/js/bootstrapValidator.js"></script>
  10. </head>
  11. <body>
  12. <div class="container">
  13. <div class="row">
  14. <div class="col-lg-8 col-lg-offset-2">
  15. <div class="page-header">
  16. <h2>Default messages</h2>
  17. </div>
  18. <form id="defaultForm" method="post" class="form-horizontal" action="target.php">
  19. <div class="form-group">
  20. <label class="col-lg-3 control-label">Full name</label>
  21. <div class="col-lg-4">
  22. <input type="text" class="form-control" name="firstName" placeholder="First name" />
  23. </div>
  24. <div class="col-lg-4">
  25. <input type="text" class="form-control" name="lastName" placeholder="Last name" />
  26. </div>
  27. </div>
  28. <div class="form-group">
  29. <label class="col-lg-3 control-label">Username</label>
  30. <div class="col-lg-5">
  31. <input type="text" class="form-control" name="username" />
  32. </div>
  33. </div>
  34. <div class="form-group">
  35. <label class="col-lg-3 control-label">Email address</label>
  36. <div class="col-lg-5">
  37. <input type="text" class="form-control" name="email" />
  38. </div>
  39. </div>
  40. <div class="form-group">
  41. <label class="col-lg-3 control-label">Password</label>
  42. <div class="col-lg-5">
  43. <input type="password" class="form-control" name="password" />
  44. </div>
  45. </div>
  46. <div class="form-group">
  47. <label class="col-lg-3 control-label">Retype password</label>
  48. <div class="col-lg-5">
  49. <input type="password" class="form-control" name="confirmPassword" />
  50. </div>
  51. </div>
  52. <div class="form-group">
  53. <label class="col-lg-3 control-label">Gender</label>
  54. <div class="col-lg-5">
  55. <div class="radio">
  56. <label>
  57. <input type="radio" name="gender" value="male" /> Male
  58. </label>
  59. </div>
  60. <div class="radio">
  61. <label>
  62. <input type="radio" name="gender" value="female" /> Female
  63. </label>
  64. </div>
  65. <div class="radio">
  66. <label>
  67. <input type="radio" name="gender" value="other" /> Other
  68. </label>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="form-group">
  73. <label class="col-lg-3 control-label">Age</label>
  74. <div class="col-lg-3">
  75. <input type="text" class="form-control" name="age" />
  76. </div>
  77. </div>
  78. <div class="form-group">
  79. <label class="col-lg-3 control-label">Website</label>
  80. <div class="col-lg-5">
  81. <input type="text" class="form-control" name="website" />
  82. </div>
  83. </div>
  84. <div class="form-group">
  85. <label class="col-lg-3 control-label">Phone number</label>
  86. <div class="col-lg-5">
  87. <input type="text" class="form-control" name="phoneNumber" />
  88. </div>
  89. </div>
  90. <div class="form-group">
  91. <label class="col-lg-3 control-label">Languages</label>
  92. <div class="col-lg-5">
  93. <div class="checkbox">
  94. <label>
  95. <input type="checkbox" name="languages[]" value="english" /> English
  96. </label>
  97. </div>
  98. <div class="checkbox">
  99. <label>
  100. <input type="checkbox" name="languages[]" value="french" /> French
  101. </label>
  102. </div>
  103. <div class="checkbox">
  104. <label>
  105. <input type="checkbox" name="languages[]" value="german" /> German
  106. </label>
  107. </div>
  108. <div class="checkbox">
  109. <label>
  110. <input type="checkbox" name="languages[]" value="russian" /> Russian
  111. </label>
  112. </div>
  113. <div class="checkbox">
  114. <label>
  115. <input type="checkbox" name="languages[]" value="other" /> Other
  116. </label>
  117. </div>
  118. </div>
  119. </div>
  120. <div class="form-group">
  121. <label class="col-lg-3 control-label">Programming Languages</label>
  122. <div class="col-lg-5">
  123. <div class="checkbox">
  124. <label>
  125. <input type="checkbox" name="programs[]" value="net" /> .Net
  126. </label>
  127. </div>
  128. <div class="checkbox">
  129. <label>
  130. <input type="checkbox" name="programs[]" value="java" /> Java
  131. </label>
  132. </div>
  133. <div class="checkbox">
  134. <label>
  135. <input type="checkbox" name="programs[]" value="c" /> C/C++
  136. </label>
  137. </div>
  138. <div class="checkbox">
  139. <label>
  140. <input type="checkbox" name="programs[]" value="php" /> PHP
  141. </label>
  142. </div>
  143. <div class="checkbox">
  144. <label>
  145. <input type="checkbox" name="programs[]" value="perl" /> Perl
  146. </label>
  147. </div>
  148. <div class="checkbox">
  149. <label>
  150. <input type="checkbox" name="programs[]" value="ruby" /> Ruby
  151. </label>
  152. </div>
  153. <div class="checkbox">
  154. <label>
  155. <input type="checkbox" name="programs[]" value="python" /> Python
  156. </label>
  157. </div>
  158. <div class="checkbox">
  159. <label>
  160. <input type="checkbox" name="programs[]" value="javascript" /> Javascript
  161. </label>
  162. </div>
  163. </div>
  164. </div>
  165. <div class="form-group">
  166. <div class="col-lg-9 col-lg-offset-3">
  167. <button type="submit" class="btn btn-primary" name="signup" value="Sign up">Sign up</button>
  168. <button type="submit" class="btn btn-primary" name="signup2" value="Sign up 2">Sign up 2</button>
  169. </div>
  170. </div>
  171. </form>
  172. </div>
  173. </div>
  174. </div>
  175. <script type="text/javascript">
  176. $(document).ready(function() {
  177. $('#defaultForm').bootstrapValidator({
  178. message: 'This value is not valid',
  179. feedbackIcons: {
  180. valid: 'glyphicon glyphicon-ok',
  181. invalid: 'glyphicon glyphicon-remove',
  182. validating: 'glyphicon glyphicon-refresh'
  183. },
  184. fields: {
  185. firstName: {
  186. validators: {
  187. notEmpty: {},
  188. stringCase: {
  189. 'case': 'upper'
  190. }
  191. }
  192. },
  193. lastName: {
  194. validators: {
  195. notEmpty: {},
  196. stringCase: {
  197. 'case': 'upper'
  198. }
  199. }
  200. },
  201. username: {
  202. message: 'The username is not valid',
  203. validators: {
  204. notEmpty: {},
  205. stringLength: {
  206. min: 6,
  207. max: 20
  208. },
  209. regexp: {
  210. regexp: /^[a-zA-Z0-9_\.]+$/
  211. },
  212. remote: {
  213. url: 'remote.php',
  214. message: 'The username is not available'
  215. },
  216. different: {
  217. field: 'password',
  218. message: 'The username and password cannot be the same as each other'
  219. }
  220. }
  221. },
  222. email: {
  223. validators: {
  224. emailAddress: {}
  225. }
  226. },
  227. password: {
  228. validators: {
  229. notEmpty: {},
  230. identical: {
  231. field: 'confirmPassword',
  232. message: 'The password and its confirm are not the same'
  233. },
  234. different: {
  235. field: 'username',
  236. message: 'The password cannot be the same as username'
  237. }
  238. }
  239. },
  240. confirmPassword: {
  241. validators: {
  242. notEmpty: {},
  243. identical: {
  244. field: 'password'
  245. },
  246. different: {
  247. field: 'username',
  248. message: 'The password cannot be the same as username'
  249. }
  250. }
  251. },
  252. age: {
  253. validators: {
  254. notEmpty: {},
  255. digits: {},
  256. greaterThan: {
  257. value: 18
  258. },
  259. lessThan: {
  260. value: 100
  261. }
  262. }
  263. },
  264. website: {
  265. validators: {
  266. notEmpty: {},
  267. uri: {}
  268. }
  269. },
  270. phoneNumber: {
  271. validators: {
  272. notEmpty: {},
  273. digits: {},
  274. phone: {
  275. country: 'US'
  276. }
  277. }
  278. },
  279. gender: {
  280. validators: {
  281. notEmpty: {}
  282. }
  283. },
  284. 'languages[]': {
  285. validators: {
  286. notEmpty: {}
  287. }
  288. },
  289. 'programs[]': {
  290. validators: {
  291. choice: {
  292. min: 2,
  293. max: 4
  294. }
  295. }
  296. }
  297. }
  298. });
  299. });
  300. </script>
  301. </body>
  302. </html>