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

Custom errors #323

Closed
ghost opened this issue Sep 13, 2013 · 2 comments
Closed

Custom errors #323

ghost opened this issue Sep 13, 2013 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 13, 2013

Hi Guys!

So, basically, i'm using bootstrap and i want to set the error messages format so i can match my website pattern.

In order to do this, i need to get the Element ( as the observable element or elements ) being validated and also the error message i set.

An example:

var viewModelUser = ko.validatedObservable({
email: ko.observable().extend({ required: { message: 'Please supply your email address.' } }),

if (viewModelUser.isValid() == false) {
var errors = viewModelUser.errors();
for (var j = 0; j < errors.length; j++) {
// HERE I NEED TO GET THE ELEMENT AND THE ERROR MESSAGE ITSELF
}
return false;
}

How can i do this?

Thanks in advange!

@stevegreatrex
Copy link
Contributor

Unfortunately that isn't possible at the moment, though there has been some discussion of it in #298

@ghost
Copy link
Author

ghost commented Sep 17, 2013

Thanks Steve!

@ghost ghost closed this as completed Sep 17, 2013
This issue was closed.
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