Questions tagged [backbone.validation.js]

A validation plugin for Backbone.js that validates both your model as well as form input

A validation plugin for Backbone.js that validates both your model as well as form input http://thedersen.com/projects/backbone-validation

22 questions
4
votes
1 answer

How to use Backbone.Validation plugin with Marionette.js

I am using Twitter Bootstrap3 with Backone.Validation(http://thedersen.com/projects/backbone-validation/) plugin in my Marionette.js app, but some how cannot get it right at all. can any one please give a simple example on how to use…
2
votes
1 answer

Validation groups for Backbone.Validation

I have a Backbone model, say User, and I want to reuse it in a Sign Up page and in a Change settings page.. In the Sign Up page I have a form with two fields: email and password both required, while in the Change Settings page there is another form…
Andrea
  • 15,900
  • 18
  • 65
  • 84
2
votes
1 answer

Weird Backbone.Validation bug when used with require.js and backbone.stickit

I amusing T. Hedersen's backbone.validation plugin (https://github.com/thedersen/backbone.validation) in conjunction with backbone.stickit plugin for model binding. I am running into a weird error where in it constantly validates all the fields when…
1
vote
0 answers

Validations as warning for model attributes using backbone.validations plugin

As the subject suggests, i am using backbone validation plugin for form fields validation. It works fine for fields to be validated and stop form submission with errors. I would like to implement a validation which acts like warning. User will see…
Lokesh Yadav
  • 1,574
  • 5
  • 23
  • 50
1
vote
1 answer

How can I test the validations of a model if I use backbone validation

I have a backbone model var MyModel= Backbone.Model.extend({ validation: function () var validate= { name: { required: true, }, }; return validate; }, }); I use sinon, mocha and chai…
1
vote
1 answer

Selectively validate model attributes using Backbone Validation plugin?

I'm using the Backbone Validation plugin and would like to selectively validate different sets of model attributes at different times, is this possible? My test model has validation for name, age and address and if I wanted to validate only…
styler
  • 15,779
  • 23
  • 81
  • 135
1
vote
1 answer

backbone.validation plugin. Validation doesn't work on model

I try to to use Backbone.validation plugin. Here is a link to this plugin. https://github.com/thedersen/backbone.validation. I want to start a validation, when I create a new model instance. Normally in Backbone should implement a validate function…
1
vote
1 answer

Skip validation of model attribute using Backbone.Validation

I have a view that is rendered dynamically. It may have some inputs or may not have. After a user fills everything and tries to send data I call this.model.isValid(true) ( or this.model.isValid() ) and it returns false even if the data from inputs…
nllsdfx
  • 900
  • 14
  • 30
1
vote
1 answer

How to add my own validator with Backbone.validation?

And I want to create my own validator with Backbone.validation. I have tried this: _.extend(Backbone.Validation.validators, { myValidator: function(value, attr, customValue, model) { if(value !== customValue){ return…
1
vote
1 answer

Detect Backbone model validation for any undesired attributes

I implemented this simple feature to detect any undesired or unspecified attributes in a Backbone Model: var Underscore = require( '/usr/local/lib/node_modules/underscore' ), Backbone = require( '/usr/local/lib/node_modules/backbone' ), …
Alain
  • 1,450
  • 3
  • 20
  • 37
1
vote
1 answer

Backbone.js validation get list of properties from model for which the validation has failed

I want to get a list of all model's properties that have failed validation. For example say my model is as the one below var OfferModel = Backbone.Model.extend({ , defaults: function () { return { Name: '', …
Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281
0
votes
3 answers

Check if AJAX response data if is empty or null than don't show in output

This is ajax function, I want when data is null or undefined than output (#access element) show me empty "" ( or don't save any data in output when is null or not found ) $(function(){ $('#userId').on('keyup', function () { var…
ARROW
  • 1
  • 1
  • 3
0
votes
2 answers

model.isValid always returns undefined

When I call isValid() on my backbone model it always returns undefined even when the validation rules have been met or not. What could be going wrong here? What could be the problem here and how can I fix it? My Model: Backbone.Model.extend({ …
sazr
  • 24,984
  • 66
  • 194
  • 362
0
votes
1 answer

One rule to validate several inputs with Backbone.validation

I have 10 inputs for instance. And I want to check if they're empty using one rule but avoiding reiteration like this: firstInput :{ required: true, msg: 'Empty!' }, // ... tenthInput :{ required: true, msg: 'Empty!' } Is there any…
nllsdfx
  • 900
  • 14
  • 30
0
votes
0 answers

Validation error not showing in right place

I have appended a select box dynamically inside a td tag using jquery and assigned that class required-entry but when i submit form validation not showing on the right place. this is my appended code. var addrow = '
1
2