Commits

Matthew Schinckel committed 024483c

Actually store the name of the validator: this prevents duplicates and allows removing/changing validators.

  • Participants
  • Parent commits 70ce16c

Comments (0)

Files changed (1)

File src/knockout.validators.js

           // Also apply the error class to relevant elements.
           // Note that this is not sufficient for Bootstrap: you need to
           // have a class on 'error' on a parent div, and a .control-group if there is one.
-          if ($('link[href*=bootstrap][rel=stylesheet]').length) {
+          
+          if (true || $('link[href*=bootstrap][rel=stylesheet]').length) {
             $targets = $targets.add($targets.parent()).add($targets.closest('.control-group'));
           }
           if (message.length) {
     function applyValidators(options) {
       $.each(options, function(name, data){
         var found = defaultValidators[name] || existingValidator(name) || {};
-        var validator = {};
+        var validator = {name: name};
         $.each(["validator", "testValue", "message", "html5attr"], function(i, attr) {
           validator[attr] = data[attr] || found[attr];
         });
     }
   };
   
-  ko.subscribable.fn.validate.validationMessageTemplate = "<label class='help-inline'></label>";
+  ko.subscribable.fn.validate.validationMessageTemplate = "<label class='help-block'></label>";
 })();