Template Event not working for using Modals for Meteorjs

- QUESTION -

Hi I am using peppelg:bootstrap-3-modal for using modal in Meteor.
Modal template code
<template name="requestBooking">
  <div class="modal fade">
          <div class="modal-dialog modal-lg">
            <div class="modal-content">
                  <div class="modal-header">
                      <h3 style="margin-bottom: 25px; text-align: center;">Request Tutorial</h3>
                  </div>
                  <div class="modal-body">
                    <form role="form">

                    .................

                    <div class="form-group">
                      <button type="button" id="submit" name="submit" class="btn btn-primary pull-right ">Request Booking</button>
                  </div>
                </form>
              </div>

              <div class="modal-footer">
                <button type="button" id ="request" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
              </div>
            </div>
        </div>
    </div>
</template>
And my template event listener
Template.requestBooking.events({
  "submit form": function(event, template){
    event.preventDefault();
    console.log("Clicked submit");
  }
});
And my javascript console is not logging anything

- ANSWER -
You just need to set a submit type for your Request Booking button.
<button type="submit" class="btn btn-primary pull-right">Request Booking</button>

0 comments:

Post a Comment

Powered by Blogger.