Skip to content
This repository
Browse code

Include null as non-value for validatesPresent

  • Loading branch information...
commit 24fe97d9bb601475e180b7fe3aab60613ed4ff1f 1 parent 199f82b
Matthew Eernisse authored March 23, 2013

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  lib/validators.js
3  lib/validators.js
@@ -33,7 +33,8 @@ var utils = require('utilities')
33 33
 var validators = {
34 34
   present: function (name, val, params, rule, locale) {
35 35
     var msg;
36  
-    if (typeof val === "undefined" || val=="") {
  36
+    // Empty string, null/undefined (null is double-equal to undefined)
  37
+    if (val == '' || val == undefined) {
37 38
       //'Field "' + name + '" is required.';
38 39
       msg = rule.message || i18n.getText('model.validatesPresent',
39 40
         {name: name}, locale);

0 notes on commit 24fe97d

Please sign in to comment.
Something went wrong with that request. Please try again.