Browse Source

#14, #57: Support URL input (type="url")

nghuuphuoc 12 years ago
parent
commit
25e852041e
4 changed files with 16 additions and 1 deletions
  1. 7 0
      demo/html5.html
  2. 4 0
      dist/js/bootstrapValidator.js
  3. 1 1
      dist/js/bootstrapValidator.min.js
  4. 4 0
      src/js/validator/uri.js

+ 7 - 0
demo/html5.html

@@ -54,6 +54,13 @@
                     </div>
 
                     <div class="form-group">
+                        <label class="col-lg-3 control-label">Website</label>
+                        <div class="col-lg-5">
+                            <input class="form-control" name="website" type="url" required data-bv-uri-message="The input is not a valid website address" />
+                        </div>
+                    </div>
+
+                    <div class="form-group">
                         <div class="col-lg-9 col-lg-offset-3">
                             <button type="submit" class="btn btn-primary">Sign up</button>
                         </div>

+ 4 - 0
dist/js/bootstrapValidator.js

@@ -1549,6 +1549,10 @@
 }(window.jQuery));
 ;(function($) {
     $.fn.bootstrapValidator.validators.uri = {
+        enableByHtml5: function($field) {
+            return ('url' == $field.attr('type'));
+        },
+
         /**
          * Return true if the input value is a valid URL
          *

File diff suppressed because it is too large
+ 1 - 1
dist/js/bootstrapValidator.min.js


+ 4 - 0
src/js/validator/uri.js

@@ -1,5 +1,9 @@
 (function($) {
     $.fn.bootstrapValidator.validators.uri = {
+        enableByHtml5: function($field) {
+            return ('url' == $field.attr('type'));
+        },
+
         /**
          * Return true if the input value is a valid URL
          *