Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What validation library pairs well with Backbone.js?

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?

like image 755
John Munsch Avatar asked Oct 22 '11 22:10

John Munsch


People also ask

Why use Backbone JS?

BackboneJS allows developing of applications and the frontend in a much easier way by using JavaScript functions. BackboneJS provides various building blocks such as models, views, events, routers and collections for assembling the client side web applications.

Does backbone need jQuery?

You can use the Backbone. Model without jQuery, but Backbone.

What is module in Backbone JS?

js respectively. The rest of your application code should be divided into modules that can live under their own modules directory. A module is an encapsulated group of structures (for the purposes of our post, Backbone structures) that work cohesively to provide a subset of functionality in your application.

How does Backbone JS work?

Backbone. js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.


1 Answers

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

like image 71
Geert-Jan Avatar answered Sep 21 '22 14:09

Geert-Jan