8000 format(), formatLabel() not being added to custom validator · Issue #98 · thedersen/backbone.validation · GitHub
[go: up one dir, main page]

Skip to content
format(), formatLabel() not being added to custom validator #98
@jpaas

Description

@jpaas

I have 2 custom validators and for some strange reason, one gets the this.format() and this.formatLabel() methods and the other doesn't.

  _.extend Backbone.Validation.validators,
    isDate: (value, attr, dateFormat, model)->
      return @format("{0} must be a valid date of the format {1}", @formatLabel(attr, model), dateFormat) if dateFormat && !(value instanceof Date)

    isIpAddress: (value, attr, customValue, model)->
      return @format("Not a valid {0}", @formatLabel(attr, model)) if !value.match(Backbone.Validation.patterns.isIpAddress)

isDate always gets them, isIpAddress never gets them. I've tried reordering them, renaming them, removing isDate, but no matter what I do isIpAddress never gets them. Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0