Sha256: 8fbb91e9f294faf72897ed8dd0cadc70e5afba84a035e5aefbccc2a7d5e5f5f3

Contents?: true

Size: 383 Bytes

Versions: 1

Compression:

Stored size: 383 Bytes

Contents

ValidationError = require "hoarder/validator/error/validation_error"

#
# @author - Tim Shelburne <tim@musiconelive.com>
#
# 
#
class RequiredConstraint
  canHandle: (type)->
    type is "required"

  handle: (element)->
    if element.value? and element.value isnt ""
      return []
    else
      return [ new ValidationError "This field is required." ]

return RequiredConstraint

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hoarder-js-0.0.1 assets/scripts/coffee/hoarder/validator/constraints/required_constraint.coffee