4

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.

Community
  • 1
  • 1
manu4543
  • 508
  • 1
  • 8
  • 15

1 Answers1

1

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
    }
})
asloan
  • 123
  • 7