Cannot pass some field data to Mailchimp using Redirect URL

alryalls 23 Jul, 2013
Hi folks

I have bought and followed GreyHead's guide: ChronoForms v4 How-to doc Linking forms to other places Part 1.

I have built the form and configured the fields map in the Redirect URL action configuration like so:

u=********************
id=**********
EMAIL={EMAIL}
FNAME={FNAME}
LNAME={LNAME}
MERGE3[addr1]={MERGE3[addr1]}
MMERGE3[addr2]={MMERGE3[addr2]}
MMERGE3[city]={MMERGE3[city]}
MMERGE3[state]={MMERGE3[state]}


There are lots of other fields, but in the excerpt above, the last four entries do not pass any data. I think it must be the format, i.e. the extra text in the square brackets because data for email, first name etc works fine.

The fields with square brackets in their names are an address group and I can't see a way in Mailchimp to apply specific "normal" field names to the individual fields.

Is this something that I can fix with my Chronoforms setup, or should I contact Mailchimp?

Many thanks

Al
GreyHead 23 Jul, 2013
Hi Al,

On the ChronoForms side please try using the Model ID dot syntax
MERGE3[addr1]={MERGE3.addr1}
. I think this will work, if not then you can convert the array into three separate entries.

If this is a MailChimp link do you actually need to send the user to MailChimp? If not, the cURL [GH] action might be better.

Bob
alryalls 24 Jul, 2013
Hi Bob

Many thanks for your help🙂

I downloaded the cURL [GH] action, added the fields like this:

MERGE3[addr1]={MERGE3.addr1}


and added the target url, same as before. I also removed the original Redirect URL and Redirect User actions.

Is this correct? As it's not working. When I click submit I get a blank page and no new subscriber in MC.

Are there other configuration requirements that I'm missing?

Thanks again

Al
GreyHead 24 Jul, 2013
Hi Al,

I can't tell from the info here. Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.
Bob
alryalls 24 Jul, 2013
Thanks Bob

I added the debugger action but now when I click submit, the debug information page displays for a split second then the Mailchimp page is loaded, showing that there were errors (required address fields not passed again). Even though I am now using the Model ID dot syntax. If I go 'back' in the browser it just goes back to the form, so I can't grab the debug info.

When removing the debugger action the page doesn't redirect.

Actions screenshot:
Cannot pass some field data to Mailchimp using Redirect URL image 1

And cURL [HG] settings:

Target URL:
http://******.us5.list-manage.com/subscribe/post

Params/Fields map:
u=********************
id=*********
EMAIL={EMAIL}
FNAME={FNAME}
LNAME={LNAME}
MERGE3[addr1]={MERGE3.addr1}
MMERGE3[addr2]={MMERGE3.addr2}
MMERGE3[city]={MMERGE3.city}
MMERGE3[state]={MMERGE3.state}
MMERGE3[zip]={MMERGE3.zip}
MMERGE3[country]={MMERGE3.country}
MMERGE4={MMERGE4}
MMERGE5={MMERGE5}
MMERGE6={MMERGE6}
MMERGE7={MMERGE7}
MMERGE8={MMERGE8}
MMERGE9={MMERGE9}
MMERGE10={MMERGE10}
group[4641][1]={group.4641.1}
group[4641][2]={group.4641.2}
group[4641][4]={group.4641.4}
group[4641][8]={group.4641.8}
group[4641][16]={group.4641.16}
group[4641][32]={group.4641.32}
group[4641][64]={group.4641.64}
group[4641][128]={group.4641.128}
group[4641][256]={group.4641.256}
group[4693][512]={group.4693.512}
group[4693][1024]={group.4693.1024}
EMAILTYPE={EMAILTYPE}

Cheers

Al
alryalls 25 Jul, 2013
Ok so I realised switching the actions order might help. 🤣

Here's the debugger output:

Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => customerregistrations
[event] => submit
[FNAME] => Al
[LNAME] => Ryalls
[EMAIL] => ****@****.com
[MERGE3] => Array
(
[addr1] => 11 *****
[addr2] => *******
[city] => ******
[state] => *******
[zip] => ********
[country] => United Kingdom
)

[MMERGE4] => *********
[MMERGE10] =>
[MMERGE8] =>
[MMERGE6] =>
[MMERGE7] =>
[group] => Array
(
[4641] => Array
(
[1] =>
[2] =>
[4] =>
[8] =>
[16] =>
[32] =>
[64] =>
[128] =>
[256] =>
)

[4693] => Array
(
[512] =>
[1024] =>
)

)

[chrono_verification] => zgRmX
[input_submit_4] => Submit
[customerid] =>
[76cb008055803fcf7b2e267ce647039d] => 1
)
Validation Errors:
Array
(
)

Debug Data
Core Captcha
Passed the core captcha check!
cURL [GH]
cURL OK : the cURL function was found on this server.
cURL Target URL: http://********.us5.list-manage.com/subscribe/post
Names + values (urldecoded)
u : *********************
id : **********
EMAIL : *****@********.com
FNAME : Al
LNAME : Ryalls
MERGE3[addr1] :
MMERGE3[addr2] :
MMERGE3[city] :
MMERGE3[state] :
MMERGE3[zip] :
MMERGE3[country] :
MMERGE4 : *************
MMERGE5 :
MMERGE6 :
MMERGE7 :
MMERGE8 :
MMERGE9 :
MMERGE10 :
group[4641][1] :
group[4641][2] :
group[4641][4] :
group[4641][8] :
group[4641][16] :
group[4641][32] :
group[4641][64] :
group[4641][128] :
group[4641][256] :
group[4693][512] :
group[4693][1024] :
EMAILTYPE :
cURL Values: u=********************&id=*************&EMAIL=******@******.com&FNAME=Al&LNAME=Ryalls&MERGE3[addr1]=&MMERGE3[addr2]=&MMERGE3[city]=&MMERGE3[state]=&MMERGE3[zip]=&MMERGE3[country]=&MMERGE4=**********&MMERGE5=&MMERGE6=&MMERGE7=&MMERGE8=&MMERGE9=&MMERGE10=&group[4641][1]=&group[4641][2]=&group[4641][4]=&group[4641][8]=&group[4641][16]=&group[4641][32]=&group[4641][64]=&group[4641][128]=&group[4641][256]=&group[4693][512]=&group[4693][1024]=&EMAILTYPE=
cURL:Resource id #278
cURL info: Array ( [url] => http://******.us5.list-manage.com/subscribe/post [content_type] => text/html; charset=UTF-8 [http_code] => 200 [header_size] => 462 [request_size] => 610 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.399095 [namelookup_time] => 0.039152 [connect_time] => 0.07905 [pretransfer_time] => 0.079058 [size_upload] => 459 [size_download] => 34509 [speed_download] => 86468 [speed_upload] => 1150 [download_content_length] => -1 [upload_content_length] => 0 [starttransfer_time] => 0.299084 [redirect_time] => 0 [certinfo] => Array ( ) [redirect_url] => )
Response: HTTP/1.1 200 OK Server: nginx Date: Thu, 25 Jul 2013 05:28:22 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Vary: Accept-Encoding X-UA-Compatible: IE=edge,chrome=1 Set-Cookie: _AVESTA_ENVIRONMENT=prod; path=/ Set-Cookie: PHPSESSID=pfm2d1a9dbl1sfptcbje1ga2m4; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache
alryalls 25 Jul, 2013
Hi, sorry to bump, but I really need to get this sorted.

These field names are a problem

group[4641][1]
group[4641][2]

because as well as the data not being passed, I'm unable to create a table in chronoforms for form data storage on the website.

I get:

Field name "group[4641][1]" is invalid, please fix the field name in the wizard (or the form code) then retry again.

Any advice would be great.

Many thanks

Al
alryalls 26 Jul, 2013
I've fixed the square brackets issue now, but I have another problem now.

In the debug output, you can see my checkboxes have values (these are individual checkboxes, not an array):

group[4641][1] : 1
group[4641][2] : 0
group[4641][4] : 0
group[4641][8] : 1
group[4641][16] : 0
group[4641][32] : 0
group[4641][64] : 0
group[4641][128] : 0
group[4641][256] : 0
group[4693][512] : 1
group[4693][1024] : 0

trouble is, in mailchimp, the result is that all the checkboxes are checked. Whereas the mailchimp form works correctly when testing directly on mailchimp. Even if I leave them all unchecked, they pass as all checked.

I've tried setting the default value of the checkboxes to 1 and the Ghost value to 0, as you can see in the debug output, but this doesn't work.

I have a Save to DB action enabled and the entries are saved as per the debug output.

Does anyone know what might be causing this?

Al
GreyHead 26 Jul, 2013
Hi Al,

What does MailChimp need to show a checkbox is checked or un-checked? Quite possibly it wants an empty string for an un-checked box instead of a '0'??

Bob
alryalls 26 Jul, 2013
Hi Bob

The thing is I was still getting the same behaviour with different settings in the checkboxes. i.e. the default (Field default value 1 and no ghost setting), also tried 0 for the default lol, same - all checked in mailchimp. :?

Many thanks for your help

Al
GreyHead 26 Jul, 2013
Hi Al,

What does MailChimp need to show a checkbox is checked or un-checked?

Bob
GreyHead 26 Jul, 2013
Hi Al,

Not quite what I was looking for but looking at the MailChimp form the checkboxes have value 1 so that should be OK. I suggest that you try an empty string for 'un-checked' and see if that works.

Bob
alryalls 30 Jul, 2013
Hi Bob

I've found that 1, 0, true, false, empty string values all result in a checked box.

If I submit the URL myself and omit fieldname=value, this leaves it unchecked. Can we get chronoforms to do this? i.e. if a check box is unchecked don't try and pass fieldname=0/false/empty/whatever

Thanks
Al
GreyHead 31 Jul, 2013
Hi Al,

I've just posted an updated version of my cURL [GH] action and I've added a feature where if you use == in the Params/Fields map box then the parameter will be ignored if no value is set.
banana=={checkbox_name}

You need to make sure in this case that the Ghost box is not checked.

I've run some tests and it looks to be working OK but let me know if you find any bugs please.

Bob
alryalls 31 Jul, 2013
Hi Bob

Fantastic🙂 Thanks very much 😀

It's working perfectly.

I just bought you a beer!

Kind regards
Al
GreyHead 31 Jul, 2013
Hi Al,

Thank you, much appreciated.

Bob

PS I do think that this is a MailChimp bug though - they ought to check for a value on checkbox parameters rather than just presence . . .
alryalls 31 Jul, 2013
You're most welcome🙂

Yes I agree completely. Plus the fact you can't change the checkbox field names, so you're stuck with group[xxxx][x] etc.

Have a great day🙂

Al
This topic is locked and no more replies can be posted.