• Resolved popmillipede

    (@popmillipede)


    I have successfully connected my wordpress site to Mailchimp via the MC4WP plugin with an API key. I can see my custom fields and other mailchimp account info.

    I created a form using MC4WP and deployed it to a test page. It looks fine but won’t submit. It generates the following error. I’ve tried multiple times, recreated from scratch, commented out all fields but the name and email, and I always get the same error. Any ideas on why this doesn’t work.

    Note: I’m able to successfully submit contacts using an embedded mailchimp form at https://electangelabirney.com/endorse-angela/. But I like the form-building experience better in MC4WP and it looks much better on mobile with no mods vs the mailchimp-created form.

    POST https://us21.api.mailchimp.com/3.0/lists/5c8e09bb16/members

    {“status”:”subscribed”,”email_address”:”gsch***@ho*****.com”,”interests”:{},”merge_fields”:{“FNAME”:”G”,”LNAME”:”S”,”MMERGE6″:”Hope this works”,”PHONE”:”5551212″,”TITLE”:”Ambassador”},”email_type”:”html”,”ip_signup”:”73.59.104.9″,”tags”:[“endorser2023″,”webform”]}

    Response:

    400 Bad Request

    {“type”:”https://mailchimp.com/developer/marketing/docs/errors/”,”title”:”Invalid Resource”,”status”:400,”detail”:”Your merge fields were invalid.”,”instance”:”6415dca7-dd48-f650-eca5-b7886d81b4c9″,”errors”:[{“field”:”ENDTYPE”,”message”:”Please enter a value”}]}

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Lap

    (@lapzor)

    The field ENDTYPE is set to be a required field, but it’s not added to the form.


    You can check in your Mailchimp.com account under Audience settings > Fields if certain fields are marked as required. If they are, you either need to add those fields to all your forms and integrations, or uncheck the box “required”.

    Hope that helps. If you have any questions, please let me know!

    Thread Starter popmillipede

    (@popmillipede)

    Thanks for the reply Lap. I’m confused about a few things:
    1. The ENDTYPE field is on the form.

    ENDORSEMENT TYPE:??ELECTED OFFICIAL??COMMUNITY MEMBER

    <p>
        <label>Endorsement Type:</label>
        <label>
            <input name="ENDTYPE" type="radio" value="0" required=""> <span>Elected official</span>
        </label>
        <label>
            <input name="ENDTYPE" type="radio" value="1" required=""> <span>Community member</span>
        </label>
    </p>

    2. ENDTYPE is not required in my master field setup in Mailchimp. But a response is required on this form. Regardless, it’s on the form so this shouldn’t matter.
    3. I ran a test removing all fields but name and email and it still generates the same error.

    Thread Starter popmillipede

    (@popmillipede)

    I figured this out and think it may be a bug in the Mailchimp API. You were correct that I had set ENDTYPE to required. I was looking in the form builder but should have looked in the master list of fields. It was set there and should not have been since it’s not required on every form (whereas first/last name and email are).

    However, this doesn’t matter unless you’re using the API. And it doesn’t matter if ENDTYPE is included in the form (as it is with my MC4WP test form) and sent by the API. It still fails if a custom field is required in the master list. I figured this out when using a Mailchimp integration on Anedot (campaign donation service). It sends a few donor fields to Mailchimp but knows nothing about ENDTYPE. However it generated this error:

    {
    "type": "https://mailchimp.com/developer/marketing/docs/errors/",
    "title": "Invalid Resource",
    "detail": "Your merge fields were invalid.",
    "errors": [{
    "field": "ENDTYPE",
    "message": "Please enter a value"
    }],
    "status": 400,
    "instance": "bf2c9d47-aa6b-e740-c703-cb1be742c086"
    }

    Unchecking Required in the master list for ENDTYPE fixed the issue for both apps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error when submitting form’ is closed to new replies.