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

  • SEARCH
  • Home
  • 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 8196613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:32:22+00:00 2026-06-07T05:32:22+00:00

I’m using backbone for a reasonably complicated form. I have a number of nested

  • 0

I’m using backbone for a reasonably complicated form. I have a number of nested models, and have been computing other variables in the parent model like so:

// INSIDE PARENT MODEL

computedValue: function () {
    var value = this.get('childModel').get('childModelProperty');
    return value;
}

This seems to work fine for keeping my UI in sync, but as soon as I call

.save()

on the parent model, I get:

Uncaught TypeError: Object #<Object> has no method 'get' 

It seems that the child model kind of temporarily stops responding.

Am I doing something inherently wrong?

EDIT: The stack trace is:

Uncaught TypeError: Object #<Object> has no method 'get' publish.js:90
Backbone.Model.extend.neutralDivisionComputer publish.js:90
Backbone.Model.extend.setNeutralComputed publish.js:39
Backbone.Events.trigger backbone.js:163
_.extend.change backbone.js:473
_.extend.set backbone.js:314
_.extend.save.options.success backbone.js:385
f.Callbacks.o jquery.min.js:2
f.Callbacks.p.fireWith jquery.min.js:2
w jquery.min.js:4
f.support.ajax.f.ajaxTransport.send.d

EDIT #2 in response to comment below:

There’s something basic I’m still not getting. I replaced a few references to this.get(‘childModel’)[‘childModelProperty’] and now I get things like
‘cannot read property childModelProperty of undefined.

I’m not yet pulling anything from the server, the parent model is just created like

define(['jquery', 'underscore', 'backbone', 'models/childmodel'],    function($, _, Backbone, ChildModel) {
var ParentModel = Backbone.Model.extend({
defaults: {
   childModel : new ChildModel()
    }
  • 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-06-07T05:32:23+00:00Added an answer on June 7, 2026 at 5:32 am

    defaults are only used when you create the model. After save is called, it will call set which will overwrite childModel with a simple javascript object. As I see it you have a couple options:

    1) use Backbone.Relational

    2) override set in each parent model to update the existing child model (or create it) something like the following:

    children:{
        childModel: ChildModel
    }
    set: function (key, value, options) {
                    var attrs;
                    if (_.isObject(key) || key == null) {
                        attrs = key;
                        options = value;
                    } else {
                        attrs = {};
                        attrs[key] = value;
                    }
    
                    _.each(this.children, function (childType, name) {
                        if (!attrs.hasOwnProperty(name))
                            return;
    
                        //assume the child is just a model--not a collection
                        var newValue = attrs[name];
                        delete attrs[name];
                        var isModel = this[name] && this[name].set;
                        if (isModel && newValue) {
                            this[name].set(newValue, options);
                        }
                        else if (newValue) {
                            this[name] = new childType(newValue);
                        }
                        else {
                            delete this[name];
                        }
    
                        this.trigger('change:' + name);
    
                    }, this);
    
                    return Backbone.Model.prototype.set.call(this, attrs, options);             
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the

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.