Reputation: 556
I am using Backbone form - https://github.com/powmedia/backbone-forms.
In few fields I am using custom template for a specific field. Lets say something like this
Now Lets say I want to attach a click event handler to "Add month". What is the best way to accomplish it. I see that Backbone.Form is extending Backbone.View which has accepts events object. But when I pass that while doing new Backbone.Form() it does't do anything.
Upvotes: 4
Views: 239
Reputation: 123
You should be able to extend the Backbone.Form view to add your own custom events, like this
Backbone.Form.extend({
events: _.extend(this.events, {
'click .add-month': 'onClickAddMonth'
}),
onClickAddMonth: function(e){
// do something
}
})
Upvotes: 1