8000 Add can.Map method to validate single property · Issue #40 · canjs/can-validate · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add can.Map method to validate single property #40
Open
@Macrofig

Description

@Macrofig

Need to be able to validate a single property without causing validation of the entire map.

Given we have a map like

const TestMap = can.Map.extend({
  define: {
    firstName: {
      type: 'string',
      validate: {
        required: true
      }
    },
    lastName: {
      type: 'string',
      validate: {
        required: true
      }
    }
  }
});
const testMap = new TestMap({});

Then we need to be able to validate a single property like

testMap.validate('firstName');

This behavior would also set errors on the map.

Need to also document how to validate a single property without setting errors. (Using can.validate.once.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0