Skip to content

Custom errors #323

@ghost

Description

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!

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