Preventdefault isn't working

I have this Autoform on a view details page:

{{> quickForm collection="Messages" id="createMessageForm" type="insert" omitFields="createdAt" buttonContent="Submit"}}

and in template events:

"submit form": function(event) {
    event.preventDefault();
  }

When submit is clicked, I get thrown to another page. Could it be that Iron Router is overwriting the preventdefault function?

You might try

"submit form": function(event) {
    return false;
}

instead. From the documentation:

Returning false from a handler is the same as calling both stopImmediatePropagation and preventDefault on the event.

No. Check if the line event.preventDefault(); is even called (put a debugger statement before the line or console.log('IS CALLED')).

return false; does nothing for me. It still takes me back to the list view I have.

console.log('IS CALLED') does fire on submit, so I’m stuck at not knowing how to stay on the current page on submit.

My router config looks like this:

Router.route('/view/:_id', {
  name: 'ViewChat',
  controller: 'ChatsController',
  action: 'view',
  where: 'client'
});

And the route action:

view: function() {
    this.render('ViewChat', {});
  }

I found the documentation for you. It’s the behavior of autoform :wink: https://github.com/aldeed/meteor-autoform/#form-types. event.preventDefault() usually works for normal forms.