powmedia / backbone.bootstrap-modal

Bootstrap Modal wrapper for use with Backbone.
MIT License
183 stars 97 forks source link

return data #72

Closed hlarcher closed 10 years ago

hlarcher commented 10 years ago

Great job with this plugin, worked out of the box but now I'm having trouble figuring out how to get data from the content on Ok click, for example lets say I have an input field and write something in it, how do I get that data out when I click ok?

Thanks in advance

powmedia commented 10 years ago

That depends on how you implement the view that you inject into the modal, e.g.:

var myView = new Backbone.View(...);

var modal = new Backbone.BootstrapModal({ content: myView }).open();

modal.on('ok', function() {
  var val = myView.$('input').val();
});
hlarcher commented 10 years ago

Makes sense, thanks a lot