0

I'm using KnoockoutJS and the validation plugin from here, https://github.com/ericmbarnard/Knockout-Validation.

By default, validation messages only appear after a field has been modified. The problem is that when the user clicks "Save", I need to validate the bound observable regardless of whether the user has modified the field or not.

I can't seem to find a .Validate()on an obervable...

Kye
  • 5,919
  • 10
  • 49
  • 84

2 Answers2

3

Looks like ko.validation.validateObservable might be what you're looking for... I didn't test it, but that looks like it.

MHollis
  • 1,449
  • 9
  • 23
0

I use ko.validatedObservable($data)().isValid() to get whether the viewmodel is false or not.

If there is somebody who knows a better way, please leave a comment :)

Stefan Turcanu
  • 904
  • 9
  • 13