Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add can.Map method to validate single property #40

Open
Macrofig opened this issue Nov 18, 2016 · 0 comments
Open

Add can.Map method to validate single property #40

Macrofig opened this issue Nov 18, 2016 · 0 comments

Comments

@Macrofig
Copy link
Contributor

Macrofig commented Nov 18, 2016

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant