container.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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="col-lg-8 col-lg-offset-2">
  17. <div class="page-header">
  18. <h2>Profile</h2>
  19. </div>
  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">Full name</label>
  23. <div class="col-lg-4">
  24. <input type="text" class="form-control" name="firstName" placeholder="First name" />
  25. <span class="help-block" id="firstNameMessage" />
  26. </div>
  27. <div class="col-lg-4">
  28. <input type="text" class="form-control" name="lastName" placeholder="Last name" />
  29. <span class="help-block lastNameMessage" />
  30. </div>
  31. </div>
  32. <div class="form-group">
  33. <label class="col-lg-3 control-label">Username</label>
  34. <div class="col-lg-5">
  35. <input type="text" class="form-control" name="username" />
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. <div class="col-lg-9 col-lg-offset-3">
  40. <button type="submit" class="btn btn-primary">Sign up</button>
  41. </div>
  42. </div>
  43. </form>
  44. </div>
  45. </section>
  46. <!-- :form -->
  47. </div>
  48. </div>
  49. <script type="text/javascript">
  50. $(document).ready(function() {
  51. $('#defaultForm').bootstrapValidator({
  52. message: 'This value is not valid',
  53. feedbackIcons: {
  54. valid: 'glyphicon glyphicon-ok',
  55. invalid: 'glyphicon glyphicon-remove',
  56. validating: 'glyphicon glyphicon-refresh'
  57. },
  58. fields: {
  59. firstName: {
  60. container: '#firstNameMessage',
  61. validators: {
  62. notEmpty: {
  63. message: 'The first name is required and cannot be empty'
  64. }
  65. }
  66. },
  67. lastName: {
  68. container: '.lastNameMessage',
  69. validators: {
  70. notEmpty: {
  71. message: 'The last name is required and cannot be empty'
  72. }
  73. }
  74. },
  75. username: {
  76. message: 'The username is not valid',
  77. validators: {
  78. notEmpty: {
  79. message: 'The username is required and cannot be empty'
  80. },
  81. stringLength: {
  82. min: 6,
  83. max: 30,
  84. message: 'The username must be more than 6 and less than 30 characters long'
  85. }
  86. }
  87. }
  88. }
  89. });
  90. });
  91. </script>
  92. </body>
  93. </html>