ソースを参照

#542, #666: Add blank validator, thanks to @bermo

phuoc 11 年 前
コミット
c2bb706312

+ 3 - 0
CHANGELOG.md

@@ -2,6 +2,9 @@
 
 ## v0.5.2 (not released yet)
 
+__New features__
+* [#542](https://github.com/nghuuphuoc/bootstrapvalidator/issues/542), [#666](https://github.com/nghuuphuoc/bootstrapvalidator/pull/666): Add blank validator, thanks to [@bermo](https://github.com/bermo)
+
 __Improvements__
 
 * [#345](https://github.com/nghuuphuoc/bootstrapvalidator/issues/345), [#454](https://github.com/nghuuphuoc/bootstrapvalidator/pull/454): The [different](http://bootstrapvalidator.com/validators/different/) validator allows more than a 2-way comparison, thanks to [@AlaskanShade](https://github.com/AlaskanShade)

+ 2 - 1
CONTRIBUTORS.md

@@ -11,6 +11,7 @@ I would like to give big thanks to the following contributors:
 * [@Arkni](https://github.com/Arkni)
 * [@Azuka](https://github.com/Azuka)
 * [@beeglebug](https://github.com/beeglebug)
+* [@bermo](https://github.com/bermo)
 * [@blackfyre](https://github.com/blackfyre)
 * [@CeRBeR666](https://github.com/CeRBeR666)
 * [@Djarnis](https://github.com/Djarnis)
@@ -26,7 +27,6 @@ I would like to give big thanks to the following contributors:
 * [@gercheq](https://github.com/gercheq)
 * [@grzesiek](https://github.com/grzesiek)
 * [@henningda](https://github.com/henningda)
-* [@kenny-evitt](https://github.com/kenny-evitt)
 * [@ikanedo](https://github.com/ikanedo)
 * [@iplus](https://github.com/iplus)
 * [@jcnmulio](https://github.com/jcnmulio)
@@ -35,6 +35,7 @@ I would like to give big thanks to the following contributors:
 * [@jswale](https://github.com/jswale)
 * [@Jvanderheide](https://github.com/Jvanderheide)
 * [@jzhang6](https://github.com/jzhang6)
+* [@kenny-evitt](https://github.com/kenny-evitt)
 * [@khangvm53](https://github.com/khangvm53)
 * [@kristian-puccio](https://github.com/kristian-puccio)
 * [@leegtang](https://github.com/leegtang)

+ 1 - 1
dist/css/bootstrapValidator.min.css

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.2-dev, built on 2014-08-24 11:55:54 AM
+ * @version     v0.5.2-dev, built on 2014-08-24 3:49:20 PM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 30 - 1
dist/js/bootstrapValidator.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.2-dev, built on 2014-08-24 11:55:54 AM
+ * @version     v0.5.2-dev, built on 2014-08-24 3:49:20 PM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -1960,6 +1960,35 @@
     };
 }(window.jQuery));
 ;(function($) {
+    $.fn.bootstrapValidator.validators.blank = {
+        /**
+         * Placeholder validator that can be used to display a custom validation message
+         * returned from the server
+         * Example:
+         *
+         * (1) a "blank" validator is applied to an input field.
+         * (2) data is entered via the UI that is unable to be validated client-side.
+         * (3) server returns a 400 with JSON data that contains the field that failed
+         *     validation and an associated message.
+         * (4) ajax 400 call handler does the following:
+         *
+         *      bv.updateMessage(field, 'blank', errorMessage);
+         *      bv.updateStatus(field, 'INVALID');
+         *
+         * @see https://github.com/nghuuphuoc/bootstrapvalidator/issues/542
+         * @see https://github.com/nghuuphuoc/bootstrapvalidator/pull/666
+         * @param {BootstrapValidator} validator The validator plugin instance
+         * @param {jQuery} $field Field element
+         * @param {Object} options Can consist of the following keys:
+         * - message: The invalid message
+         * @returns {Boolean}
+         */
+        validate: function(validator, $field, options) {
+            return true;
+        }
+    };
+}(window.jQuery));
+;(function($) {
     $.fn.bootstrapValidator.i18n.callback = $.extend($.fn.bootstrapValidator.i18n.callback || {}, {
         'default': 'Please enter a valid value'
     });

ファイルの差分が大きいため隠しています
+ 2 - 2
dist/js/bootstrapValidator.min.js


+ 9 - 10
src/js/validator/blank.js

@@ -1,30 +1,29 @@
-(function ($) {
-
+(function($) {
     $.fn.bootstrapValidator.validators.blank = {
         /**
-         * placeholder validator that can be used to display a custom validation message 
+         * Placeholder validator that can be used to display a custom validation message
          * returned from the server
          * Example:
          *
-         * (0) a "blank" validator is applied to an input field.
-         * (1) data is entered via the UI that is unable to be validated client-side.  
-         * (2) server returns a 400 with JSON data that contains the field that failed 
+         * (1) a "blank" validator is applied to an input field.
+         * (2) data is entered via the UI that is unable to be validated client-side.
+         * (3) server returns a 400 with JSON data that contains the field that failed
          *     validation and an associated message.
-         * (3) ajax 400 call handler does the following:
+         * (4) ajax 400 call handler does the following:
          *
          *      bv.updateMessage(field, 'blank', errorMessage);
          *      bv.updateStatus(field, 'INVALID');
          *
+         * @see https://github.com/nghuuphuoc/bootstrapvalidator/issues/542
+         * @see https://github.com/nghuuphuoc/bootstrapvalidator/pull/666
          * @param {BootstrapValidator} validator The validator plugin instance
          * @param {jQuery} $field Field element
          * @param {Object} options Can consist of the following keys:
          * - message: The invalid message
          * @returns {Boolean}
          */
-
-        validate: function (validator, $field, options) {
+        validate: function(validator, $field, options) {
             return true;
         }
     };
-
 }(window.jQuery));