validationjquery-validateknockout.jsupshot

Upshot/Knockout Architectural Best Practices - Which client-side validation library should be used with Knockout and Upshot?


There are at least three possible validation libraries which might work well with Knockout. These include:

Supposedly, use of standard jQuery Validation requires the “uniqueName” binding on all form input fields. Knockout doesn't generally need this so it is not provided unless requested (through a binding).

There are two contributed Knockout validation plug-ins. These are are Knockout.Validation and Knock-Knock validation. I noticed Knockout.Validation has been recently updated but Knock-Knock validation has not been updated in about a year.

My assumption then is probably either the standard jQuery validation or the Knock-Knock validation would likely be the preferred standard for use with Knockout and Upshot.

Has anyone used either of these two validation plugins in conjunction with Upshot and the entity meta-data it exposes from the server?

If so, can you please tell me which of the two is recommended for general use and perhaps offer some hints regarding their implementation?

Thank you!


Solution

  • On my current project, I am using the Knockout.Validation plugin. I found it to be superior to Knock-Knock in nearly every way. It supports every use case I could imagine. I have not used it with upshot specifically, but it is my go to library for validation with knockout js.

    jQuery Validation is discouraged because manual DOM manipulation in the view model is not in the spirit of MVVM and arguably defeats the purpose - the whole point is to abstract away from the DOM and think in terms of the VM