Alex Rivera | Logout

What validation library pairs well with Backbone.js?

Asked 2011-10-22T22:48:46.457
27

Since we're using Backbone we're not really submitting forms to a server every time we pop up a UI for the user to enter some data. But several of the popular validation frameworks assume you have a <form> to go with your various inputs (and we don't) and that you're going to submit that form (I'm not).

What validation framework pairs well with something and allows me to trigger when it validates and doesn't care whether my controls are in a form or not?

Edit
Report

1 Answer

3

Interesting question. I haven't had luck finding a 100% solution myself so don't see this as a direct answer to your question, but it might help how this could potentially be tackled best IMO.

To me, the best fit would be validation-rules completely defined in Json, with both a client-side and server side declarative validation-'builder' that would build the rules from the definition. This would enable DRY (server / client) validation.

JSON-schema is pretty limited for this.

I believe Kansojs.org has a pretty good JSON definition for validation, but I have yet to come across the builders that implement it.

I raised a question about this some time ago, but I fear my essay-like question triggered no response :) DRY user-input validation (clientside, serverside) using JSON-schema

hope that helps some, Geert-Jan

answered 2011-10-23T12:08:46.373

Your Answer