remote.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. <!-- form: -->
  15. <section>
  16. <div class="page-header">
  17. <h1>Sign up</h1>
  18. </div>
  19. <div class="col-lg-8 col-lg-offset-2">
  20. <form id="defaultForm" method="post" class="form-horizontal" action="target.php">
  21. <div class="form-group">
  22. <label class="col-lg-3 control-label">Username</label>
  23. <div class="col-lg-5">
  24. <input type="text" class="form-control" name="username" autocomplete="off" />
  25. </div>
  26. </div>
  27. <div class="form-group">
  28. <label class="col-lg-3 control-label">Email address</label>
  29. <div class="col-lg-5">
  30. <input type="text" class="form-control" name="email[]" autocomplete="off" />
  31. </div>
  32. </div>
  33. <div class="form-group">
  34. <label class="col-lg-3 control-label">Other email address</label>
  35. <div class="col-lg-5">
  36. <input type="text" class="form-control" name="email[]" autocomplete="off" />
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <label class="col-lg-3 control-label">Password</label>
  41. <div class="col-lg-5">
  42. <input type="password" class="form-control" name="password" />
  43. </div>
  44. </div>
  45. <div class="form-group">
  46. <label class="col-lg-3 control-label">Retype password</label>
  47. <div class="col-lg-5">
  48. <input type="password" class="form-control" name="confirmPassword" />
  49. </div>
  50. </div>
  51. <div class="form-group">
  52. <label class="col-lg-3 control-label">Website</label>
  53. <div class="col-lg-5">
  54. <input type="text" class="form-control" name="website" placeholder="http://" />
  55. </div>
  56. </div>
  57. <div class="form-group">
  58. <label class="col-lg-3 control-label">Phone number</label>
  59. <div class="col-lg-5">
  60. <input type="text" class="form-control" name="phoneNumber" />
  61. </div>
  62. </div>
  63. <div class="form-group">
  64. <label class="col-lg-3 control-label">Country</label>
  65. <div class="col-lg-5">
  66. <select class="form-control" name="country">
  67. <option value="">-- Select a country --</option>
  68. <option value="fr">France</option>
  69. <option value="de">Germany</option>
  70. <option value="it">Italy</option>
  71. <option value="jp">Japan</option>
  72. <option value="ru">Russia</option>
  73. <option value="gb">United Kingdom</option>
  74. <option value="us">United State</option>
  75. </select>
  76. </div>
  77. </div>
  78. <div class="form-group">
  79. <div class="col-lg-9 col-lg-offset-3">
  80. <button type="submit" class="btn btn-primary">Submit</button>
  81. </div>
  82. </div>
  83. </form>
  84. </div>
  85. </section>
  86. <!-- :form -->
  87. </div>
  88. </div>
  89. <script type="text/javascript">
  90. $(document).ready(function() {
  91. $('#defaultForm').bootstrapValidator({
  92. message: 'This value is not valid',
  93. // live: 'disabled',
  94. feedbackIcons: {
  95. valid: 'glyphicon glyphicon-ok',
  96. invalid: 'glyphicon glyphicon-remove',
  97. validating: 'glyphicon glyphicon-refresh'
  98. },
  99. fields: {
  100. username: {
  101. message: 'The username is not valid',
  102. validators: {
  103. notEmpty: {
  104. message: 'The username is required and can\'t be empty'
  105. },
  106. remote: {
  107. type: 'POST',
  108. url: 'remote.php',
  109. message: 'The username is not available',
  110. delay: 1000
  111. },
  112. different: {
  113. field: 'password',
  114. message: 'The username and password can\'t be the same as each other'
  115. }
  116. }
  117. },
  118. 'email[]': {
  119. validators: {
  120. notEmpty: {
  121. message: 'The email address is required and can\'t be empty'
  122. },
  123. emailAddress: {
  124. message: 'The input is not a valid email address'
  125. },
  126. remote: {
  127. type: 'POST',
  128. url: 'remote.php',
  129. message: 'The email is not available',
  130. delay: 2000
  131. }
  132. }
  133. },
  134. password: {
  135. validators: {
  136. notEmpty: {
  137. message: 'The password is required and can\'t be empty'
  138. },
  139. identical: {
  140. field: 'confirmPassword',
  141. message: 'The password and its confirm are not the same'
  142. },
  143. different: {
  144. field: 'username',
  145. message: 'The password can\'t be the same as username'
  146. }
  147. }
  148. },
  149. confirmPassword: {
  150. validators: {
  151. notEmpty: {
  152. message: 'The confirm password is required and can\'t be empty'
  153. },
  154. identical: {
  155. field: 'password',
  156. message: 'The password and its confirm are not the same'
  157. }
  158. }
  159. },
  160. website: {
  161. validators: {
  162. uri: {
  163. message: 'The input is not a valid URL'
  164. }
  165. }
  166. },
  167. phoneNumber: {
  168. validators: {
  169. digits: {
  170. message: 'The value can contain only digits'
  171. }
  172. }
  173. },
  174. country: {
  175. validators: {
  176. notEmpty: {
  177. message: 'The country is required and can\'t be empty'
  178. }
  179. }
  180. }
  181. }
  182. });
  183. });
  184. </script>
  185. </body>
  186. </html>