I've been searching the forums (back 3 years or so) and have not found anything to assist me directly. I'm relatively new to Chronoforms, so please bear with me.
I've got a form that has three separate Multipliers and Multiplier Containers, when I look at the output in the debugger, all the entered data is there, however, the data is not loaded out to the email I need to send to my client. I have the email template setup to auto so it should generate a new one when I update the form.
I am assuming there is some script that I need to add, but not sure what the code should look like, or where to put it.
Debugging info follows:
Any assistance would be appreciated.
Cheers,
Neil
I've got a form that has three separate Multipliers and Multiplier Containers, when I look at the output in the debugger, all the entered data is there, however, the data is not loaded out to the email I need to send to my client. I have the email template setup to auto so it should generate a new one when I update the form.
I am assuming there is some script that I need to add, but not sure what the code should look like, or where to put it.
Debugging info follows:
Array
(
[chronoform] => Clerks_Annual_Report
[event] => submit
[tvout] => ajax
[Name_of_Congregation] => Test Church
[PIN_Number] => 07229
[Start_of_Year_Membership] => 88
[Total_Gains] => 0
[Gains_17_Under] => 0
[Gains_18_Over] => 0
[Certificate_of_Transfer] => 0
[Other_Gain] => 0
[Loss_Total] => 0
[Loss_Certificate_of_Transfer] => 0
[Loss_Deaths] => 0
[Loss_Other] => 0
[End_of_Year_Membership] => 88
[Elder_Necrology_1] => Jack
[Date_Died_1] => 12-12-2014
[Elder_Necrology_2] => Sam
[Date_Died_2] => 12-12-2014
[Session_Elder_0] => Neil
[Session_Elder_Street_0] => 711 S tester
[Session_Elder_City_ST_0] => Tester PA 11111
[Session_Elder_Phone_0] => 444-111-1111
[Session_Elder_Email_Address_0] => test@tester.com
[Session_Elder_Class_Year_0] => 2014
[Session_Elder_1] => Jack Smith
[Session_Elder_Street_1] => 111 Test St
[Session_Elder_City_ST_1] => Tester PA 11111
[Session_Elder_Phone_1] => 444-111-1111
[Session_Elder_Email_Address_1] => sprat@pratfall.com
[Session_Elder_Class_Year_1] => 2015
[Waiver_Request_1] => Sam
[Serves_On_1] => Session
[Waiver_For_Class_Year_1] => 2014
[Waiver_Request_2] => Kacy
[Serves_On_2] => Board of Deacons
[Waiver_For_Class_Year_2] => 2015
[Manse_Inspection] => No
[Date_Manse_Inspected] =>
[captcha] =>
[231335f60adaf41c77a632d067b9c57bd66f54e8] => 1
[button64] => Submit
[ip_address] => 24.239.235.229
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[7] => Array
(
[Check Honeypot] => Array
(
[0] => Honeypot check passed.
)
)
[9] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:webmaster@redstone.org
[2] => Subject:Clerk of Session's Annual Report to Presbytery
[3] => From name:Redstone Online Form
[4] => From email:webmaster@redstone.org
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Body:
<table>
<tr><td>Clerk's Report</td><td></td></tr>
<tr><td>Name of Congregation</td><td>Test Church</td></tr>
<tr><td>PC(USA) PIN Number</td><td>07229</td></tr>
<tr><td>Active Membership - 01/01/2014</td><td>88</td></tr>
<tr><td>Total Gains</td><td>0</td></tr>
<tr><td>17 & Under</td><td>0</td></tr>
<tr><td>18 & Over</td><td>0</td></tr>
<tr><td>Cert. of Trnsfr</td><td>0</td></tr>
<tr><td>Other </td><td>0</td></tr>
<tr><td>Total Losses</td><td>0</td></tr>
<tr><td>Cert. of Trnsfr</td><td>0</td></tr>
<tr><td>Deaths</td><td>0</td></tr>
<tr><td>Other Losses</td><td>0</td></tr>
<tr><td>Active Membership - 12/31/2014</td><td>88</td></tr>
<tr><td>Custom Code</td><td></td></tr>
<tr><td>Elder's Name</td><td></td></tr>
<tr><td>Date of Death</td><td></td></tr>
<tr><td>Custom Code</td><td></td></tr>
<tr><td>Name of Ruling Elder</td><td>Neil</td></tr>
<tr><td>Street Address</td><td>711 S tester</td></tr>
<tr><td>City, State and ZIP Code</td><td>Tester PA 11111</td></tr>
<tr><td>Phone #</td><td>444-111-1111</td></tr>
<tr><td>Email Address</td><td>test@tester.com</td></tr>
<tr><td>Class Year </td><td>2014</td></tr>
<tr><td>Custom Code</td><td></td></tr>
<tr><td>Person's Full Name</td><td></td></tr>
<tr><td>Serves on:</td><td></td></tr>
<tr><td>Class Year</td><td></td></tr>
<tr><td>Inspection Performed</td><td>No</td></tr>
<tr><td>Date of Inspection</td><td></td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
<tr><td>End of Report</td><td></td></tr>
</table><br /><br />IP: 24.239.235.229
)
)
)
Any assistance would be appreciated.
Cheers,
Neil
Hi Neil,
The multiplier element is very new, only added at the last update.
In order to add the dynamic data to your email template, you will need to use PHP code, unfortunately there is no other way.
if you use PHP code in your template box then the editor must be disabled and must never be enabled, you should also set the template generation to custom.
You will need to add a hidden field to the end of the multiplier section, set its name to "counter", and its value to the same value of the "replacer" option in your multiplier settings.
Now use this php code in your email template:
Regards,
Max
The multiplier element is very new, only added at the last update.
In order to add the dynamic data to your email template, you will need to use PHP code, unfortunately there is no other way.
if you use PHP code in your template box then the editor must be disabled and must never be enabled, you should also set the template generation to custom.
You will need to add a hidden field to the end of the multiplier section, set its name to "counter", and its value to the same value of the "replacer" option in your multiplier settings.
Now use this php code in your email template:
<?php
if(!empty($form->data["counter"])){
for($i = 0; $i = $form->data["counter"]; $i++){
echo "{my_field_name_".$i."}";
}
}
Regards,
Max
Hi Neil,
It looks as though the Auto template generator isn't clever enough to handle Multiple results :-(
My guess is that it only includes the first entry and that only partially. You will need to manually add the remaining values (or use PHP in a custom code action to create them).
Bob
It looks as though the Auto template generator isn't clever enough to handle Multiple results :-(
My guess is that it only includes the first entry and that only partially. You will need to manually add the remaining values (or use PHP in a custom code action to create them).
<tr><td>Person's Full Name</td><td>{Waiver_Request_1}</td></tr>
<tr><td>Serves on:</td><td>{Serves_On_1}</td></tr>
<tr><td>Class Year</td><td>{Waiver_For_Class_Year_1}</td></tr>
<tr><td>Person's Full Name</td><td>{Waiver_Request_2}</td></tr>
<tr><td>Serves on:</td><td>{Serves_On_2}</td></tr>
<tr><td>Class Year</td><td>{Waiver_For_Class_Year_2}</td></tr>
Bob
Hi Neil,
It looks as though the Auto template generator isn't clever enough to handle Multiple results :-(
My guess is that it only includes the first entry and that only partially. You will need to manually add the remaining values (or use PHP in a custom code action to create them).
<tr><td>Person's Full Name</td><td>{Waiver_Request_1}</td></tr>
<tr><td>Serves on:</td><td>{Serves_On_1}</td></tr>
<tr><td>Class Year</td><td>{Waiver_For_Class_Year_1}</td></tr>
<tr><td>Person's Full Name</td><td>{Waiver_Request_2}</td></tr>
<tr><td>Serves on:</td><td>{Serves_On_2}</td></tr>
<tr><td>Class Year</td><td>{Waiver_For_Class_Year_2}</td></tr>
Bob
Hi Bob,
Thought about that, but these are dynamically created fields. The user can add as many additional slots as they need to enter the data. Max has the right idea ... I just need to tweak it for the three different Multiplier areas I'm using.😉
Cheers
Hi Neil,
The best way I have found to do that is to structure the Multiple groups in arrays using names like this
waiver[0]['request'], waiver[0]['serves_on'], waiver[0]['class_year']
Then you will get your results as an array like this that you can easily loop through with PHP.
Bob
The best way I have found to do that is to structure the Multiple groups in arrays using names like this
waiver[0]['request'], waiver[0]['serves_on'], waiver[0]['class_year']
Then you will get your results as an array like this that you can easily loop through with PHP.
$form->data['waiver'] =>
0 => array (
request
serves_on
class_year
)
1 => array (
request
serves_on
class_year
)
. . .
Bob
Hi ...
I had to leave this for a few days, finally got back to it today. Kept on trying to get the information printed out in a way that would look OK, but nothing would work.
Then I noticed that the counter I'm using for the multiplier is not incrementing past 0 !! Should I use something else as the Replacer character. I'm using 0, with a counter 'seed' of 1. If I use 0, the array only gets loaded with the 1st and the 3rd lines of data.
I have two entry lines exposed to begin with, but I assumed that the counter should increment when I add another entry line. Its not.
The multiplier settings are as follows:
Replacer: 0
Counter: 1
Hide first: no
Disable first: no
Hide buttons: no
Start count: 1 (to enable at least 1 replication)
Data path: (blank)
I really don't want to hard code 12 (or more) entry lines, and the multiplier does solve that.
THanks in advance.
I had to leave this for a few days, finally got back to it today. Kept on trying to get the information printed out in a way that would look OK, but nothing would work.
Then I noticed that the counter I'm using for the multiplier is not incrementing past 0 !! Should I use something else as the Replacer character. I'm using 0, with a counter 'seed' of 1. If I use 0, the array only gets loaded with the 1st and the 3rd lines of data.
I have two entry lines exposed to begin with, but I assumed that the counter should increment when I add another entry line. Its not.
The multiplier settings are as follows:
Replacer: 0
Counter: 1
Hide first: no
Disable first: no
Hide buttons: no
Start count: 1 (to enable at least 1 replication)
Data path: (blank)
I really don't want to hard code 12 (or more) entry lines, and the multiplier does solve that.
THanks in advance.
Hi Neil,
Please post the Debugger output for the form with the settings that you currently have. Have you tried using array names?
Bob
Please post the Debugger output for the form with the settings that you currently have. Have you tried using array names?
Bob
Hi Neil,
Please post the Debugger output for the form with the settings that you currently have. Have you tried using array names?
Bob
Bob, I have changed the names on the data items to what you suggested on Nov 30th. Here's the output of the debugger:
Array
(
[chronoform] => Clerks_Annual_Report
[event] => submit
[tvout] => ajax
[Name_of_Congregation] => Test Church
[PIN_Number] => 07229
[Start_of_Year_Membership] => 35
[Total_Gains] => 0
[Gains_17_Under] => 0
[Gains_18_Over] => 0
[Certificate_of_Transfer] => 0
[Other_Gain] => 0
[Loss_Total] => 0
[Loss_Certificate_of_Transfer] => 0
[Loss_Deaths] => 0
[Loss_Other] => 0
[End_of_Year_Membership] => 35
[counter1] => 0
[session] => Neil,711 Test St,Tester VA 21323,333-333-3333,my@tester.com,2014,Sam,809 Debug st,Debugger PA 22211,444-444-4444,debug@tester.com,2014,Mary,911 Abort St,Test PA 13232,333-222-2222,,2015
[counter2] => 1
[waiver] => ,,
[counter3] => 0
[Manse_Inspection] => N/A
[Date_Manse_Inspected] =>
[captcha] =>
[5b44697e6335815df9a3c1c16086ed3cb00b42d1] => 1
[button64] => Submit
[ip_address] => 127.0.0.1
)
Note .. the array is called 'session', and there are three lines of data. Also note that the counter that is within the multiplier frame (counter2) only shows a value of 1.
If you're talking about the Multiplier settings, they are still the same as listed in my prior post of Dec 5th.
I've moved this from the live site, to my local system under WAMP to make it easier to test.
Thanks for the assist.
Hi Neil,
It looks as though you have a Handle Arrays action before the Debugger action so that all that is showing here is the comma separated string. Please can you move the debugger up before the Handle Arrays action (or you may not need to the Handle Arrays at all).
Bob
It looks as though you have a Handle Arrays action before the Debugger action so that all that is showing here is the comma separated string. Please can you move the debugger up before the Handle Arrays action (or you may not need to the Handle Arrays at all).
Bob
Removed the handle arrays. Here's the debugger output:
This was on the test site, no email output was produced, although the display message did appear.
Cleared the email template, set it to AUTO, and ran the form again. No email output.
Added the Handle Arrays back just before the email function: No email output.
Since my local WAMP install does not provide mail service, I backed up and restore the form to the site to test. The email is being sent, but the counter2 (the one for the area I'm testing) should show 2, still just shows 1 as it does above.
Obviously, something is not being incremented.
So to check, I did another test in another multiplier I have in the form. In this one the data item name is elder_necrology_0 .. take a look at the output:
The data item name was replaced and incremented properly, note counter1 was not incremented.
I would posit that something is not being checked after each iteration of the multiplier.
I'm willing to test any code change that is suggested.
Cheers,
Neil
PS: I'll buy you & Mac an adult beverage once we fix this🙂
Data Array
Array
(
[chronoform] => Clerks_Annual_Report
[event] => submit
[tvout] => ajax
[Name_of_Congregation] => Test Church
[PIN_Number] => 07229
[Start_of_Year_Membership] => 37
[Total_Gains] => 0
[Gains_17_Under] => 0
[Gains_18_Over] => 0
[Certificate_of_Transfer] => 0
[Other_Gain] => 0
[Loss_Total] => 0
[Loss_Certificate_of_Transfer] => 0
[Loss_Deaths] => 0
[Loss_Other] => 0
[End_of_Year_Membership] => 0
[counter1] => 0
[session] => Array
(
[0] => Array
(
['name'] => Neil
['street'] => 711 Test St
['citystz'] => Tester VA 21323
['phone'] => 333-333-3333
['email'] => my@tester.com
['class'] => 2014
)
[1] => Array
(
[‹name‹] => Sam
[‹street‹] => 809 Debug st
[‹citystz‹] => Debugger PA 22211
[‹phone‹] => 444-444-4444
[‹email‹] => debug@tester.com
[‹class‹] => 2014
)
[2] => Array
(
['name'] => Mary
['street'] => 911 Abort St
['citystz'] => Test PA 13232
['phone'] => 333-222-2222
['email'] =>
['class'] => 2015
)
)
[counter2] => 1
[waiver] => Array
(
[0] => Array
(
["name"] =>
["class"] =>
["years_served"] =>
)
)
[counter3] => 0
[Manse_Inspection] => Array
(
[0] => N/A
)
[Date_Manse_Inspected] =>
[captcha] =>
[a40e615837549b1aeae05b23ceb6d9f031273006] => 1
[button64] => Submit
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[7] => Array
(
[Check Honeypot] => Array
(
[0] => Honeypot check passed.
)
)
)
This was on the test site, no email output was produced, although the display message did appear.
Cleared the email template, set it to AUTO, and ran the form again. No email output.
Added the Handle Arrays back just before the email function: No email output.
Since my local WAMP install does not provide mail service, I backed up and restore the form to the site to test. The email is being sent, but the counter2 (the one for the area I'm testing) should show 2, still just shows 1 as it does above.
Obviously, something is not being incremented.
So to check, I did another test in another multiplier I have in the form. In this one the data item name is elder_necrology_0 .. take a look at the output:
Array
(
[chronoform] => Clerks_Annual_Report
[event] => submit
[tvout] => ajax
[Name_of_Congregation] => Test Church
[PIN_Number] => 07229
[Start_of_Year_Membership] => 43
[Total_Gains] => 0
[Gains_17_Under] => 0
[Gains_18_Over] => 0
[Certificate_of_Transfer] => 0
[Other_Gain] => 0
[Loss_Total] => 0
[Loss_Certificate_of_Transfer] => 0
[Loss_Deaths] => 0
[Loss_Other] => 0
[End_of_Year_Membership] => 0
[Elder_Necrology_1] => Jack
[Elder_Necrology_2] => Sam
[Elder_Necrology_3] => Mary
[Elder_Necrology_4] => Jessie
[counter1] => 0
[session] => Array
(
[0] => Array
(
['name'] => Neil
['street'] => 711 Test St
['citystz'] => Tester VA 21323
['phone'] => 333-333-3333
['email'] =>
['class'] => 2014
)
[1] => Array
(
[‹name‹] => Sam
[‹street‹] => 809 Debug st
[‹citystz‹] => Debugger PA 22211
[‹phone‹] => 444-444-4444
[‹email‹] =>
[‹class‹] => 2014
)
)
[counter2] => 1
[waiver] => Array
(
[0] => Array
(
["name"] =>
["class"] =>
["years_served"] =>
)
)
[counter3] => 0
[Manse_Inspection] => Array
(
[0] => N/A
)
[Date_Manse_Inspected] =>
[captcha] =>
[27cedd451e0fd1fb1fa341e2bb001a785ab8bb72] => 1
[button64] => Submit
)
The data item name was replaced and incremented properly, note counter1 was not incremented.
I would posit that something is not being checked after each iteration of the multiplier.
I'm willing to test any code change that is suggested.
Cheers,
Neil
PS: I'll buy you & Mac an adult beverage once we fix this🙂
Hi Neil,
Assuming that your fields names will be kept in the format suggested by Bob:
Then you can send me a message using the "Contact us" page and I will add a new feature to the Email action to let you easily loop through the records, you would use something like this:
So the section between the 2 {repeat} tags will be repeated N times, and the data path is specified in the start tag.
Otherwise you can do it in PHP using a "foreach" loop.
Regards,
Max
Assuming that your fields names will be kept in the format suggested by Bob:
[session] => Array
(
[0] => Array
(
['name'] => Neil
['street'] => 711 Test St
['citystz'] => Tester VA 21323
['phone'] => 333-333-3333
['email'] => my @[at] tester [dot] com
['class'] => 2014
)
[1] => Array
(
[‹name‹] => Sam
[‹street‹] => 809 Debug st
[‹citystz‹] => Debugger PA 22211
[‹phone‹] => 444-444-4444
[‹email‹] => debug @[at] tester [dot] com
[‹class‹] => 2014
)
[2] => Array
(
['name'] => Mary
['street'] => 911 Abort St
['citystz'] => Test PA 13232
['phone'] => 333-222-2222
['email'] =>
['class'] => 2015
)
)
Then you can send me a message using the "Contact us" page and I will add a new feature to the Email action to let you easily loop through the records, you would use something like this:
{repeat:session}
{name} - {street}
{/repeat}
So the section between the 2 {repeat} tags will be repeated N times, and the data path is specified in the start tag.
Otherwise you can do it in PHP using a "foreach" loop.
Regards,
Max
Perfect ... I suspect I'm not the only one who would like to see this built into the system.
Neil
Neil
Guys,
I am completely blocked here too. I am trying to send an array of data via email with multiplier but cannot get the values through.
I tried using the PHP code you suggested which seems like an simple straghht forward solution:
However, when i inserted it into the send email action, email template field, the captcha will suddenly stop rendering.
Hence, my suggestion would be for you to include send email action on your example demo-fields-multiplier, to see how sending data from arrays properly via email would work.
It would save all of us a lot of time.
Hope you consider this suggestion constructive.
Rgds,
Jorge
I am completely blocked here too. I am trying to send an array of data via email with multiplier but cannot get the values through.
I tried using the PHP code you suggested which seems like an simple straghht forward solution:
<?php
if(!empty($form->data["counter"])){
for($i = 0; $i = $form->data["counter"]; $i++){
echo "{my_field_name_".$i."}";
}
}
However, when i inserted it into the send email action, email template field, the captcha will suddenly stop rendering.
Hence, my suggestion would be for you to include send email action on your example demo-fields-multiplier, to see how sending data from arrays properly via email would work.
It would save all of us a lot of time.
Hope you consider this suggestion constructive.
Rgds,
Jorge
Hi Jorge,
I would probably do it slightly differently - so for your 'session' data: In a Custom Code action before the Email action:
You can of course change the layout of the HTML and mix in other elements if you need them.
Bob
I would probably do it slightly differently - so for your 'session' data: In a Custom Code action before the Email action:
<?php
if ( !empty($form->data['session']) && is_array($form->data['session'] ) ) {
$session = array();
foreach ( $form->data['session'] as $s ) {
$session[] = "<p>{$s['name']} : {$s['street']}, {$s['citystz']}<br />Tel: {$s['phone']} Email: {$s['email']} Class: {$s['class']}</p>";
}
}
$form->data['session_data'] = implode("\n", $session);
?>
Then add {session_data} in the Email template.
You can of course change the layout of the HTML and mix in other elements if you need them.
Bob
Thank you for the point to create a Custom Code session in contrast to using the PHP code:
Updated changes:
[attachment=0]settings.PNG[/attachment]
[attachment=1]custom-code.PNG[/attachment]
[attachment=2]email-template.PNG[/attachment]
[attachment=3]array-success.PNG[/attachment]
[attachment=4]no-email-data.PNG[/attachment]
I'm not too bright, obviously, but I would like to understand more about how to get the data to post in the email.
Updated changes:
[attachment=0]settings.PNG[/attachment]
[attachment=1]custom-code.PNG[/attachment]
[attachment=2]email-template.PNG[/attachment]
[attachment=3]array-success.PNG[/attachment]
[attachment=4]no-email-data.PNG[/attachment]
I'm not too bright, obviously, but I would like to understand more about how to get the data to post in the email.
This topic is locked and no more replies can be posted.