Hi all,
I have set up a basic registration form (name & email) which works perfectly.
What I would like to add is that when someone presses submit the subscriber receives an confirmation email + .pdf attachment.
I've read about the File Downloader action but that's not what I'm looking for.
What I want is a confirmation email to the user (already found that tutorial) with a .pdf attachment.
Hopefully someone can put me in the right direction.
Thanks in advance!
I have set up a basic registration form (name & email) which works perfectly.
What I would like to add is that when someone presses submit the subscriber receives an confirmation email + .pdf attachment.
I've read about the File Downloader action but that's not what I'm looking for.
What I want is a confirmation email to the user (already found that tutorial) with a .pdf attachment.
Hopefully someone can put me in the right direction.
Thanks in advance!
HI rphl33,
Please see this FAQ for one solution using CFv 4.
Bob
Hi GreyHead,
Thank you for your quick response.
Unfortunately I haven't been able to make the form work with the attachments.
I'll explain what I have till now:
Events tab looks like this:
On Load
1. Load Captcha
2. Show html
On Submit
1. Check Captcha
1.1 On Success
1.2 OnFail -> Event Loop
2. Email [GH]
3. Custom Code
4. Show Thanks Message
Email [GH] works just fine for processing the form, except I'm unable to attach the pdfs to the submit.
The two .PDFs can be found in my joomla media manager. From what I understand I am supposed to use JPATH_SITE in the php because of the media manager (?).
At File Attachments I have written: {input_name}images/pdf/formulier01.pdf{/input_name}, {input_name}images/pdf/formulier02.pdf{/input_name}
Custom Code contains:
<?php
if ( !isset($form->data['radiobox']) || count($form->data['radiobox']) == 0 ) {
return;
}
$files_array = array (
JPATH_SITE.'/images/pdf/formulier01.pdf',
JPATH_SITE.'/images/pdf/formulier02.pdf',
);
$attach_files = array();
foreach ( $files_array as $k => $v ) {
if ( in_array($k, $form->data['radiobox']) ) {
$attach_files[] = $v;
}
}
$form->data['file_array'] = $attach_files;
?>
The user is supposed to click which .pdf he would like to receive by choosing between two radioboxes.
What is the mistake I have made?
Thank you in advance!
I have been testing around a bit by just trying some other php code.
Understood that this code is for testing (my php knowledge is subzero).
Putting as much info as I can in this topic.
When I use
I get:
When I use
I get:
The Admin receives the data from the form. The user never receives an email.
Hope this clears things up a bit, thanks!
Understood that this code is for testing (my php knowledge is subzero).
Putting as much info as I can in this topic.
When I use
<?php
echo '<pre>';
print_r($_POST);
echo '</pre>';
?>
I get:
<?php
Array
(
[input_text_12] =>
[input_text_13] =>
[input_text_14] =>
[input_text_15] =>
[input_text_16] =>
[input_radio_17] =>
[chrono_verification] =>
[input_submit_18] => Submit
)
?>
When I use
<?php
print_r($form->data)
?>
I get:
Array ( [chronoform] => keuze_form [event] => submit [Itemid] => 108 [option] => com_content [view] => article [id] => 4 [input_text_12] => Naam [input_text_13] => straat [input_text_14] => adres [input_text_15] => 0612345678 [input_text_16] => @hotmail.com [input_radio_17] => optieA [chrono_verification] => NSmDa [input_submit_18] => Submit [9bb14d3f9a07a586dbbbb6be7abe30e5] => 1 [IPADDRESS] => 77.164.90.163 )
The Admin receives the data from the form. The user never receives an email.
Hope this clears things up a bit, thanks!
Latest update.
My PHP is now as follows:
I have replaced the $form with the formn ame in the chronoforms program.
The Custom Code with the php in it has been been moved up in On Submit.
The order is as follows:
1. Check Captcha
1.1 On Success
1.1 On Fail -> Event Loop
2. Custom Code (php)
3. Email [GH]
4. Show Thanks Message
I would have thought that replacing $form with $name_of_my_form would solve it.
What else could I have overlooked?
Thanks!
My PHP is now as follows:
<?php
if ( !isset($voetbal_donateur_form->data['radioboxes']) || count($voetbal_donateur_form->data['radioboxes']) == 0 ) {
return;
}
$files_array = array (
1 => JPATH_SITE.'http://www.etcetera1.pdf',
2 => JPATH_SITE.'http://www.etcetera2.pdf',
);
$attach_files = array();
foreach ( $files_array as $k => $v ) {
if ( in_array($k, $voetbal_donateur_form->data['radioboxes']) ) {
$attach_files[] = $v;
}
}
$voetbal_donateur_form->data['file_array'] = $attach_files;
print_r($_POST)
?>
I have replaced the $form with the formn ame in the chronoforms program.
The Custom Code with the php in it has been been moved up in On Submit.
The order is as follows:
1. Check Captcha
1.1 On Success
1.1 On Fail -> Event Loop
2. Custom Code (php)
3. Email [GH]
4. Show Thanks Message
I would have thought that replacing $form with $name_of_my_form would solve it.
What else could I have overlooked?
Thanks!
I can't find an edit button so I'll post my latest tries in a new message.
I have added a debugger at the end of the Submit area.
What I got:
I noticed that whatever radiobox I choose it always says it comes from "input_radio_17".
What I thought I should do next is let my PHP know it has to look at input_radio_17.
My php:
Result = still no result.
Admin receives form; user still doesn't receive a .pdf.
I have added a debugger at the end of the Submit area.
What I got:
Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => voetbal_donateur_form
[event] => submit
[Itemid] =>
[input_text_12] => Name
[input_text_13] => Street
[input_text_14] => Address
[input_text_15] => phone
[input_text_16] => email
[input_radio_17] => radiobox option
[chrono_verification] => AE3zY
[input_submit_18] => Submit
[a65f6c919aedc844149f022974440e8d] => 1
[IPADDRESS] => 77.164.90.163
)
Validation Errors:
Array
(
)
I noticed that whatever radiobox I choose it always says it comes from "input_radio_17".
What I thought I should do next is let my PHP know it has to look at input_radio_17.
My php:
<?php
if ( !isset($voetbal_donateur_form->data['[b]input_radio_17[/b]']) || count($voetbal_donateur_form->data['[b]input_radio_17[/b]']) == 0 ) {
return;
}
$files_array = array (
1 => JPATH_SITE.'http://www.etcetera.pdf',
2 => JPATH_SITE.'http://www.etcetera.pdf',
);
$attach_files = array();
foreach ( $files_array as $k => $v ) {
if ( in_array($k, $voetbal_donateur_form->data['[b]input_radio_17[/b]']) ) {
$attach_files[] = $v;
}
}
$voetbal_donateur_form->data['file_array'] = $attach_files;
print_r($_POST)
?>
Result = still no result.
Admin receives form; user still doesn't receive a .pdf.
This topic is locked and no more replies can be posted.