Knockout-Contrib/Knockout-Validation — pull request #298 by volpav (2013-07-05 13:17:29+00:00)
Title: Extended validation details.

We're using Knockout Validation quite extensively on one of our current projects and one of the requirements for this project is that when client-side validation fails, the system should:

- Highlight those fields that didn't pass validation.
- Show validation summary, a section at the top of the page with the complete list of validation messages where every message has a format *[field label]*: *[validation message]*.

Basically, what I needed is an ability to get from Knockout a bit more detailed information on every validation error (not just its textual representation which is available already). Turned out, it's not possible without creating custom rules or performing some hacks.

Here's how the new functionality works:

```Javascript
// Getting errors
var errors = o.validation.group(this, {
deep: true,
observable: false
});

// New method: getting extended details
var details = errors.getDetails();

for (var i = 0; i < details.length; i++) {
var d = details[i];

/*
Every element contains the following fields:

"observable" - a reference to the target observable.
"error" - the error message.
"rule" - the name of the failed validation rule.
"data" - an object that contains extension data (provided via "extend" method) for every rule. E.g. "data.required == true".
*/
}
```

I hope that this functionality can be incorporated into the core library.

Let me know what you think.

Best regards,
Pavel Volgarev