Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7032837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:59:11+00:00 2026-05-28T00:59:11+00:00

I must be doing something dumb, or maybe missing some crucial part of the

  • 0

I must be doing something dumb, or maybe missing some crucial part of the Backbone documentation, but I cant understand why the Model.validate function is firing when I initialize a new Collection in this way: http://jsfiddle.net/5a3k/QSeH6/ ..any ideas where I’m going wrong?

edit: changed title

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:59:11+00:00Added an answer on May 28, 2026 at 12:59 am

    By executing this line:

    var myCollection = new Collection([{id: 'smith'}]);
    

    You create new collection with one model. All models passed in the constructor will be added into the collection. Each added model is validated.

    Details:

    1. Backbone.Collection constructor is calling this.reset() (source).
    2. .reset() will silently add all the models into the collection (source).
    3. .add() will call internal ._add() for each model (source).
    4. Internal ._add() will call .prepareModel which is checking if the model is valid (source).

    Update (based on edit in the question):

    model.validate is executed only if the model is not instance of Backbone.Model (source).

    So if you create a collection using

    var myCollection = new Collection([{id: 'smith'}]);
    

    then the model is instance of Object. But if you use:

    var myCollection = new Collection([ new Model({id: 'smith'}) ]);
    

    then the model is instance of Backbone.Model and validation is skipped.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I must be doing something wrong, but I could use some advice on the
Must be missing something really obvious here but how do you change the size
Below is my FULL code. I must be doing something dumb. I've used this
I must be doing something dumb: float ans = (i/3); So why when i
I must be doing something stupid here, because I have some very similar code
I must be doing something obviously wrong here. But what is it, and how
I must be doing something obvious, but I can't figure out what it is.
I referred to this page, but I must be doing something wrong: jQuery check
I thought this markup should work, but it I must be doing something wrong.
I must be doing something totally stupid here, but I can't get the PLCrashReporter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.