Why does this code not only fail to visiblize my HTML "column" but also move to the next template (wrap around)?


I am trying to create a “wizard” type of app, where the first template is shown first, then, after the user selects the “Next” button, they go to the next template, etc.

It works until I get to what is currently the final template, where I also have an “Add Another Date” button which, when clicked, should make visible a “column” of tds/cells that are hidden.

Not only does the visiblizing not take place, though, but the next template (#1, “wrapping around” to the beginning) displays. I tried adding a call to “stopPropagation()” in case the Submit button was somehow being executed, but that did nothing to prevent this behavior.

Here is the pertinent code:

if (Meteor.isClient) {
  // stepNum starts at 1
   Session.setDefault('stepNum', 1);
   Session.setDefault('nextDate', 1);

        getStepTemplate: function () {
            var step = Session.get('stepNum');
            switch (step) {
                case 4:
                  return 'tblExpenseDescription'
                case 3:
                    return 'tblPayments'
                case 2:
                    return 'tblTravelerInfo2';
                    return 'tblTravelerInfo'
    }); // Template.postTravelWizard.helpers

        'click [type=submit]': function (e, t) {
            //save something...
            var step = Session.get('stepNum'),
            step = (step) < 4 ? ++step : 1;
            Session.set('stepNum', step);

            if ($('#visitor').is(':checked')) {
                console.log('visitor is checked');
                var visaselection =  $('select[name="selvisatype"]').val()
                console.log('visaselection is ' + visaselection);
                // When this is working (the first two return "visaselection is undefined" and the last one returns simply
                // "visaselection is "), do something similar for ucemployee (input type=radio) and selectcampus (select element)
        'change .payments' : function(event){
          var paymentTot = $('#paymenttotal').val();
          paymentTot = parseInt(paymentTot) || 0;
          var targetVal = $(event.target).val();
          targetVal = parseInt(targetVal);
          paymentTot = paymentTot + targetVal;
        'click #addDate': function(event){
           var nextD8 = Session.get('nextDate');
           nextD8 = ++nextD8;
           Session.set('nextDate', nextD8);

           if (nextD8 == 2) {
        } // 'click #addDate': function(event){
    }); // Template.postTravelWizard.events
} // if (Meteor.isClient)

if (Meteor.isServer) {
  Meteor.startup(function () {
    // code to run on server at startup


{{> postTravelWizard}}
{{> Template.dynamic template=getStepTemplate}}

The elements I’m trying to visiblize via removeClass (they invisiblize/hide fine with the CSS/HTML) are of this pattern:

Date 2: 


.hide {
  visibility: hidden;
  display: none;

Why does selecting the “Add Another Date” not only fail to show the elements such as “date2” and its brethren, but also jump jerkily forward to the next (first) template?

Note: The act of putting a breakpoint on the submit button click’s “e.PreventDefault” line ALSO causes template navigation to revert back to the first template each time I click “Next” - but only when the breakpoint is there. Without it, it moves as desired from tblTravelerInfo to tblTravelerInfo2 to tblPayments to tblExpenseDescription.

Is making the “Next” button a “Submit” button a mistake? I did so because I will be saving data each time (when leaving one template and moving to the next), but that’s not really necessary (the “Next” button being of type “Submit”), I guess. Is it problematic?


For some reason, if I change the input of type submit to a button, the wrap-around from the last template to the first no longer happens when I select “Add Another Date” on the last template (good!).

The .js has changed like so:

        'click #nextStep': function (e, t) {
            // e.preventDefault();

…and the HTML like so:


However, it still does not make visible the “column”. Do I need to call “invalidate” or some such to refresh the page?