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 7167923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:40:31+00:00 2026-05-28T14:40:31+00:00

I have a backbone model which contains an array which I am updating with

  • 0

I have a backbone model which contains an array which I am updating with a simple id (I didn’t want to add nested collection).

It seems fairly straightforward to me, but for some reason I’m getting an Uncaught TypeError: Object [object Object] has no method 'preshow' error.

I have a list of classes, and a form with the class being entered.
The user can click an item on the classlist to add it as a prerequisite to the class being edited. This triggers the ‘add_prerequisite’ in the ‘ClassInput’ view.

I’ve left out the code that I think is probably not needed.

Myapp.ClassInput = Backbone.Views.extend({
        initialize: function(){
         Myapp.class = this.model;
         Myapp.class.bind("add_prerequisite", this.add_prerequisite);
        },
        add_prerequisite: function(prerequisite){
         // this is a method in my model which adds the prerequisite id to this class
          class.add_prerequisite(prerequisite)

         //this is the line triggering the error
          this.show_pre(prerequisite);
         },

       show_pre: function(prerequisite){
          alert(prerequisite);
         }

});

Myapp.Classes.ClassList = Backbone.Views.extend({


     add_prerequisite: function(){
        Myapp.class.trigger('add_prerequisite',this.model.id);
     }
});

  • 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-28T14:40:32+00:00Added an answer on May 28, 2026 at 2:40 pm

    You need to bind the context of add_prerequisite to your backbone model.

    To do that, you just have to add a third argument to the bind method

    initialize: function() {
      Myapp.class = this.model;
      //bind the context of this.add_prerequisite to this
      Myapp.class.bind('add_prerequisite', this.add_prerequisite, this); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a super simple Backbone model/collection that wraps around a facebook feed. window.Story
I've got a backbone model with contains a collection. The output from the console
I have a backbone view - which when called presents a form $('#add-offer').click(function() {
I have a simple form that passes data to backbone, which in turn, submits
I have implemented a simple close() method for all the Backbone views which disposes
let's say I have : var Book = Backbone.Model.extend(); var Collection = Backbone.Collection.extend({ model:
I have a view which doesn't seem to want to render as the model's
I have created a new backbone.js widget model which I hope to extend: var
I have a bus model, which has a nested route model. class Busables.Models.Bus extends
I have noticed that when multiple attributes of a Backbone model are set like

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.