Sha256: b8844e3498bd1f70026a5cdb7c2646c8f363c1b0b5f5f12171d18caf708bcf83

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2010 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

sc_require('validators/validator') ;

/**
  Requires some content in field, but does not check the specific content.
  
  @class
  @extends SC.Validator
  @author Charles Jolley
  @version 1.0
*/
SC.Validator.NotEmpty = SC.Validator.extend(
/** @scope SC.Validator.NotEmpty.prototype */ {
  
  validate: function(form, field) {
    var value = field.get('fieldValue'); 
    var ret = !!value ;
    if (ret && value.length) ret = value.length > 0 ;
    return ret ;
  },
  
  validateError: function(form, field) {
    var label = field.get('errorLabel') || 'Field' ;
    return SC.$error("Invalid.NotEmpty(%@)".loc(label.capitalize()), field.get('errorLabel'));
  }
    
}) ;

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js