Router.go - goes - goes back

I am new to meteor and playing with a new project. Can someone tell me what the heck I am doing wrong. I have a simple form (projectForm) that I enter or edit project name, etc… This all works. But when I click submit, it saves the data and goes back to the page projects which is what I want but then immediately it goes back to projectForm (empty). I have read many posts and tried them all.

I am using iron router for my routes.

Here is my code.

if (this._id){
			Meteor.call('update',this._id,obj);
		
		} else {
			
			Meteor.call('addProjects', name, smartsheet_id);

		}
		


		event.target.name.value = "";
		event.target.smartsheet_id.value = "";

		Router.go('projects');
		return False;

Routes.js

Router.map(function(){
this.route('projectForm', {
		name: 'projectForm',

		template: 'projectForm',
	});


this.route('projects', {
	name: 'projects',
		path: '/projects',
		template: 'projects',
 	
    });

this.route('/update/:_id',{
    name: 'update',
	template:'projectForm',
	data:function(){
		//alert(this.params._id);
		return Projects.findOne({_id: this.params._id});
	}
});
}); ```

Your post could use some clean up by putting triple back ticks around your code. Its pretty hard to decipher at this point which may be the reason nobody else has replied, so I’ll give it a shot.

My best guess is that the default behavior for the form submission is not being prevented. It looks as though you may have tried to do so by returning false from the event handler, but your code shows return False instead of return false. Hopefully this helps :slight_smile:

1 Like

Thanks. I’m obviously new to this. I was looking for the code block but didn’t see it. Now I know.

Now on to my issue. Dammit!!! I have looked at the code for over an hour. Yes, false worked.

Thanks a ton.

1 Like