title: Submit Form in Bootstrap Modal with IronRouter / MeteorJS
body: <p>I am trying to submit a new appetizer to a web app I am creating that resembles a cookbook.  The layout has a constant header/nav that allows the user to add a new appetizer, which triggers a modal and a form containing the appetizer name, description and a photo.  I would like the modal to close upon submission, and remain on the current page of which the modal was triggered.  Currently, my submit form is not working and I am not sure where the problem is...</p>
  
  <p>The link to the current deployed version is: <a href="http://reed-cookbook.meteor.com/" rel="nofollow">http://reed-cookbook.meteor.com/</a></p>
  
  <p>My router:</p>
  
  <pre><code>// lib/router.js
  
  Router.configure({
      layoutTemplate: 'layout'
  });
  
  Router.map(function() {
      this.route('allRecipes', {
          path: '/'
      });
  
      this.route('appetizers', {
          path: '/appetizers'
      });
  
      this.route('appetizerPage', {
          path: '/appetizers/:_id',
          data: function() { return Appetizers.findOne(this.params._id); }
      });
  
      this.route('desserts', {
          path: '/desserts'
      });
  
      this.route('mainCourses', {
          path: '/maincourses'
      });
  
      this.route('submit', {
          path: '/appetizerSubmit'
      });
  });
  </code></pre>
  
  <p>My appetizer html form:</p>
  
  <pre><code>// client/views/forms/appetizerForm.html
  
  &lt;template name="appetizerForm"&gt;
      &lt;!-- This is the appetizer modal --&gt;
      &lt;div class="modal fade" id="myAppModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
        &lt;div class="modal-dialog"&gt;
          &lt;div class="modal-content"&gt;
            &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
              &lt;h4 class="modal-title" id="myModalLabel"&gt;Add An Appetizer&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class="modal-body"&gt;
                &lt;!-- This is the appetizer form --&gt;
                &lt;form&gt;
                    &lt;div class="form-group"&gt;
                        &lt;label for="inputNewLabel"&gt;Name&lt;/label&gt;
                        &lt;input type="text" class="form-control" id="addNewAppetizer" name="appName" placeholder="What is the name of this appetizer?"&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                        &lt;label for="inputNewLabel"&gt;Description&lt;/label&gt;
                        &lt;input type="text" class="form-control" id="addNewAppDesc" name="appDesc" placeholder="Share details about your appetizer."&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                        &lt;label for="inputNewLabel"&gt;Add Photo&lt;/label&gt;
                        &lt;input type="file" id="addNewAppPic" name="appPic"&gt;
                        &lt;p class="help-block"&gt;Upload a photo of your appetizer.&lt;/p&gt;
                    &lt;/div&gt;
                &lt;/form&gt;
            &lt;/div&gt;
            &lt;div class="modal-footer"&gt;
              &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
              &lt;button type="submit" class="btn btn-primary" value="submitApp"&gt;Submit Appetizer&lt;/button&gt;
            &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>My appetizerForm.js for this specific html feature:</p>
  
  <pre><code>// client/views/forms/appetizerForm.js
  
  Template.appetizerForm.events({
      'submitApp': function(e) {
          e.preventDefault();
  
          var appetizer = {
              name: $(e.target).find('[name=appName]').val(),
              description: $(e.target).find('[name=appDesc]'),
              photo: $(e.target).find('[name=appPic]').val()
          }
  
          appetizer._id = Appetizers.insert(appetizer);
          Router.go('/', appetizer);
      }
  });
  </code></pre>