I am scratching my head over an issue with backbone...
I have a backbone view, with an event which calls a function that saves the current model.
Its a simple form, in the view I do some validation before syncing the model.
this.model.save({
completed : completed,
company : company,
revenue : revenue,
term : term,
comments : comments,
probability : probability
},
{
success: function (model, response) {
console.log('success', model, response);
Evision.trackRouter.navigate("tracker/", {trigger: true});
},
error: function (model, response) {
console.log('error', model, response);
}
}
;
After success is fired it returns me back to my collection of models, where I can select another model to edit, its at this point when i attempt to save that i receive in my console and Chrome crashes.
If i expand this error it is indicating a problem with the function running the above, and my model is logged out in the console but when i try to expand it its empty?
Its worth saying that neither success or error is being fired ont he 2nd route round.
Thanks
Edit #1
Here is the error i receive before the crash
<error>
w.extend
w.clone
e.extend.toJSON
_.extend.save
_.extend.update
LocalStorage.sync
Backbone.sync
e.extend.sync
e.extend.save
Evision.Views.TrackerDetail.Backbone.View.extend.saveTracker
(anonymous function)
j
Edit #2 Here is my model
Evision.Models.Track = Backbone.Model.extend({
defaults: function() {
return {
id : Evision.trackerList.nextOrder(),
completed : false,
created : Utils.datestamp(),
company : "",
revenue : "",
term : "",
comments : "",
probability : "",
success : null
}
}
});
extend
method. Can't think of any reason why that would happen. Can you post your model code as well? – jevakallioconsole.log(this.model.toJSON())
before save and see if that outputs OK, or does it crash also? What would be great if you could try to replicate this somewhere online. Here's a empty tinker.io with Backbone etc. already loaded: tinker.io/d2fed/3 . Are you able to get this error there? – jevakallio