| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <!-- Gives example of basic form -->
- <!DOCTYPE html>
- <html>
- <head>
- <title>BootstrapValidator demo</title>
- <link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css"/>
- <link rel="stylesheet" href="../dist/css/bootstrapValidator.css"/>
- <script type="text/javascript" src="../vendor/jquery/jquery-1.10.2.min.js"></script>
- <script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
- <script type="text/javascript" src="../dist/js/bootstrapValidator.js"></script>
- <!-- Support datetime picker plugin: http://eonasdan.github.io/bootstrap-datetimepicker/ -->
- <link rel="stylesheet" href="//eonasdan.github.io/bootstrap-datetimepicker/content/bootstrap-datetimepicker.css"/>
- <script type="text/javascript" src="//eonasdan.github.io/bootstrap-datetimepicker/scripts/moment.js"></script>
- <script type="text/javascript" src="//eonasdan.github.io/bootstrap-datetimepicker/scripts/bootstrap-datetimepicker.js"></script>
- <style type="text/css">
- /* Override to make the feedback icons shown properly */
- .form .bv-input-group-icon {
- top: 25px;
- right: 35px;
- }
- </style>
- </head>
- <body>
- <div class="container-fluid">
- <div class="row">
- <div class="col-lg-8 col-lg-offset-2">
- <form id="basicExample" action="target.php" method="post">
- <div class="row">
- <div class="col-lg-1">
- <div class="form-group">
- <label for="prefix">Prefix:</label>
- <input type="text" name="prefix" class="form-control">
- </div>
- </div>
- <div class="col-lg-10">
- <div class="col-lg-4">
- <div class="form-group">
- <label for="firstname">First Name:</label>
- <input type="text" name="firstname" class="form-control">
- </div>
- </div>
- <div class="col-lg-4">
- <div class="form-group">
- <label for="middlename">Middle Name:</label>
- <input type="text" name="firstname" class="form-control">
- </div>
- </div>
- <div class="col-lg-4">
- <div class="form-group">
- <label for="lastname">Last Name:</label>
- <input type="text" name="lastname" class="form-control">
- </div>
- </div>
- </div>
- <div class="col-lg-1">
- <div class="form-group">
- <label for="suffix">Suffix:</label>
- <input type="text" name="suffix" class="form-control">
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-6">
- <div class="form-group">
- <label for="email">Email:</label>
- <input type="email" name="email" class="form-control">
- </div>
- </div>
- <div class="col-lg-6">
- <div class="form-group">
- <label for="phonenumber">Phone Number:</label>
- <input type="text" name="phonenumber" class="form-control">
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-12">
- <div class="form-group">
- <label for="languages">What Programming languages do you use?</label>
- <div class="checkbox">
- <label>
- <input type="checkbox" name="languages[]" value="php"> PHP
- </label>
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" name="languages[]" value="asp"> ASP.NET MVC
- </label>
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" name="languages[]" value="coldfusion"> ColdFusion
- </label>
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" name="languages[]" value="javascript"> JavaScript
- </label>
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" name="languages[]" value="ruby"> Ruby
- </label>
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" name="languages[]" value="python"> Python
- </label>
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" name="languages[]" value="java"> Java
- </label>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-12">
- <input type="submit" class="btn btn-primary btn-lg pull-right">
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- <script>
- $(function() {
- $('#basicExample').bootstrapValidator({
- message: 'This value is not valid',
- feedbackIcons: {
- valid: 'glyphicon glyphicon-ok',
- invalid: 'glyphicon glyphicon-remove',
- validating: 'glyphicon glyphicon-refresh'
- },
- fields: {
- prefix: {
- validators: {
- // not required
- }
- },
- firstname: {
- validators: {
- notEmpty: {
- message: 'First Name is required.'
- }
- }
- },
- middlename: {
- validators: {
- notEmpty: {
- message: 'Middle Name is required.'
- }
- }
- },
- lastname: {
- validators: {
- notEmpty: {
- message: 'Last Name is required.'
- }
- }
- },
- suffix: {
- validators: {
- // not required
- }
- },
- email: {
- validators: {
- notEmpty: {
- message: 'Email is required.'
- },
- emailAddress: {
- message: 'The value is not a valid email address.'
- }
- }
- },
- phonenumber: {
- validators: {
- notEmpty: {
- message: 'Phone number is required.'
- },
- phone: {
- country: 'US',
- message: 'The value is not a valid US phone number.'
- }
- }
- },
- 'languages[]': {
- validators: {
- notEmpty: {
- message: 'You must pick at least one.'
- }
- }
- }
- }
- });
- });
- </script>
- </body>
- </html>
|