container.html 3.7 KB

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