ericmbarnard/Knockout-Validation — pull request #161 by diachedelic (2012-11-02 01:03:44+00:00)
Title: Toggling CSS class when using validationMessage binding handler

Hi,

I was really stoked to find your plugin - it's the best! I got right into using to validate a few complex properties which use my own binding handlers.

I ran into an issue that when I used the `validationElement` binding handler on a `

` (rather than an ``) the validation message would not automatically be inserted. For my purposes, I could be validating a google map which has been bound to a `LatLng`! As you know, the power of binding handlers removes any reliance on form elements.

My workaround was to use a static element bound with `validationMessage`, but there seemed to then be no way to remove/hide the element (as it wasn't just an inline span) when it had no active error message. I forked your library and in the `validationMessage` binding handler I toggled on/off the `errorMessageClass` so that I could hide the validation message element when it was dormant.

I reckon it's pretty necessary for the kinds of crazy validation messages we have these days to have this flexibility.

Cheers,
James