Sha256: 08794bbe4e1bada6bd20eb5f0e3050e146a58a3c0cd971868b1bd524b2b944a6

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

// ==========================================================================
// Not Empty Validator
// Author: Charles Jolley
//
// Force a field to be not empty.
//
// ==========================================================================

require('validators/validator') ;
SC.Validator.NotEmpty = SC.Validator.extend({
  
  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 $error("Invalid.NotEmpty(%@)".loc(label.capitalize()), field.get('errorLabel'));
  }
    
}) ;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sproutcore-0.9.0 frameworks/sproutcore/validators/not_empty.js
sproutcore-0.9.1 frameworks/sproutcore/validators/not_empty.js