MailChimp Subscription


#1

I’m trying to build a newsletter subscription for MailChimp on my meteor site. I think I’ve done everything that the doc says, but when I click on the submit button, simply nothing happens. Why?

This is in my html:

<template name="MailChimpListSubscribe"> 
    <section class="mailchimp">
        <div class="row">
             <form id="subscribe-footer" class="form-inline">
                <input class="mailchimp-email form-control" type="email" placeholder="ADDRESS@EMAIL.COM" />
                <button class="mailchimp-subscribe btn btn-success"  type="button">SUBMIT</button>
                <div class="message signup"><p>Sign up for our newsletter</p></div>
                <label class="error-message"></label>
                {{#if message}}
                <div class="mailchimp-message message thankyou"><p>You will now receive emails from us</p></div>
                {{/if}}
            </form>
        </div>
    </section>
</template>

in server/settings.js:

{
	"private": {
		"MailChimp": {
			"apiKey": "myapikey",
			"listId": "listid"
		}
	}
}

#2

and how do you submit that form ?


#3

I guess I have this…?

Template.MailChimpListSubscribe.events({
  'submit form': function( event ) {
    event.preventDefault();
  }
});

#4

try it without the custom events, i.e. delete all of Template.MailChimpListSubscribe.events.


#5

still that button type=“button”, I would expect type=“submit” if it should do something with form


#6

I do get this error message in my console:

 handleSubscriber is not defined

#7

changed it to “submit” but it just makes the page scroll up


#8

I followed this and it helped.

https://themeteorchef.com/recipes/mailing-lists-with-mailchimp/#tmc-signup-form