Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address parameters are capitalized in request to mailchimp #76

Open
dannyk3941 opened this issue Jul 11, 2020 · 2 comments
Open

Address parameters are capitalized in request to mailchimp #76

dannyk3941 opened this issue Jul 11, 2020 · 2 comments

Comments

@dannyk3941
Copy link

I have a sign-up form in mailchimp and it also has fields for the user to input their address. When I list these parameters in list fields, I am getting the error.

{
    msg: "3 - enter complete address"
    result: "error" 
}

Looking at the headers I believe this is due to the address parameters being capitalized and not matching the exact name in HTML address fields. The names in my embedded html form has names in this way for the address fields:

<input type="text" maxLength="70" name="ADDRESS[addr1]" className="form-control mb-3" placeholder="Address / line 1*" />
<input type="text" maxLength="70" name="ADDRESS[addr2]" className="form-control mb-3" placeholder="Address / line 2" />

When I take a look at the headers in the network tab, I am seeing that the address sub-fields are being capitalized and I am thinking that may be the issue and should instead be 'ADDRESS[addr1]', etc.. in the request to mailchimp. (see below)
Screen Shot 2020-07-11 at 2 00 29 PM

Please let me know if there is a work around for this issue or if I can be pointed to any solution, that would be great!

@benjaminhoffman
Copy link
Owner

here we uppercase all fields names, and i guess apparently subfields too. ive never heard of this use case. if you can create a solution to this, im happy to merge any PRs. i dont think we currently handle this use case.
https://github.com/benjaminhoffman/gatsby-plugin-mailchimp/blob/master/src/index.js#L42

@skendanavian
Copy link

skendanavian commented Mar 18, 2021

I'm running into the exact same problem. The only case that doesn't capitalize the object keys in the NPM package is when it starts with group.

Removing field.toUpperCase() from the package will fix the problem. You just need to make sure that your other object keys are now All Caps where they need to be as the package won't auto cap the keys.

I then used https://www.npmjs.com/package/patch-package to patch the change in my version of the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants