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

Allow validation params in object without custom message #561

Open
wants to merge 3 commits into
base: v2.1.0
Choose a base branch
from

Conversation

codethug
Copy link
Contributor

Implements change discussed in #554

Before this change, you had to specify either a custom message or an onlyIf property in order to use a params object, such as this:

var testObj = ko.observable('something').extend({
  minLength: {
    params: 9,
    message: "not long enough"
  }
});

But you couldn't omit the custom message, even if you were happy with the default message. Without this pull request, this won't work:

var testObj = ko.observable('something').extend({
  minLength: {
    params: 9
    // no custom message
  }
});

You would see an error like this: Please enter at least [object Object] characters.

This pull request allows you to omit the message property and see an error message as expected. In this example, the error message would be Please enter at least 9 characters.

crissdev and others added 3 commits March 1, 2015 14:31
Localization files will now be distributed in three ways:

- included in the library itself (dist/knockout-validation-with-locales.js)
- bundle with all localization files (dist/locales.js)
- individual files in localization directory (localization/*.js)

Closes Knockout-Contrib#541
crissdev pushed a commit that referenced this pull request Jun 1, 2015
@crissdev
Copy link
Member

crissdev commented Jun 1, 2015

Thanks @codethug

Merged into v2.1.0 branch 18a554f

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

Successfully merging this pull request may close these issues.

2 participants