Reputation: 169
Good morning!
I use Backbone.js 0.9.2 (and CakePHP). My model has 4 fields: id
, name
, description
and image_id
. I add models with a name
and a description
and get the id
and image_id
from the server response and the proper change events fire (name
and description
first and id
and image_id
later).
Now, when I edit something two PUTs are sent (the resource in this case is CookingUtensils/144
).
I see one change
event for the field I edited and another general one (change
only and not change:description
, change:name
etc). I don't understand why. Both PUT requests have exactly the same body.
I simply cannot figure out what is going on. Thank you for reading. Any help would be greatly appreciated!
Upvotes: 1
Views: 115
Reputation: 10627
Is save() firing twice - once for the enter key, and once again onBlur?
Since the values only change once (the first time), you'll only get one change event. put a console.log on the save method and print out the event. Or, a breakpoint in chrome debugger/firebug and see what the stack is - what triggered the save. –
Upvotes: 1