revolunet / react-mailchimp-subscribe

React subscribe form for Mailchimp.
https://revolunet.github.io/react-mailchimp-subscribe/
244 stars 48 forks source link

Cannot add more fields #42

Closed joshpitzalis closed 4 years ago

joshpitzalis commented 4 years ago

How do I add more fields to the submission?

I tried pretty much teh same thing to try and fill in an extra field but it doesn't work. Can anyone explain why? I made sure NAME is a field in my Mailchimp audience.

Any help much appreciated.

 <MailchimpSubscribe
  url={URL}
  render={({ subscribe, status, message }) =>  (
    <>
    <p class={`f3 fw6 mb4 ${status === 'success' && 'green'} ${status === 'error' && 'red'}`}>
      { message }
      </p>
    <form onSubmit={e => {
      e.preventDefault();
      const formData = {
        EMAIL: email,
        NAME: 'Example'
      };

      subscribe(formData);
      setName('')
  }}>
    <input type="email" placeholder='Your email'
    onChange={e => setName(e.target.value)} value={email}/>
    <button>Sign Me Up</button>
  </form>
  </>)}
  />
joshpitzalis commented 4 years ago

This works fine. I was NAME where as I should have been adding MERGE1 or whatever the merge tags was called. Hope my silly mistake helps someone in the future