DB Data Into CFV5 Form's OnSubmit > Email 'Subject' & 'Body'

paulzero 21 Aug, 2017
Hi Max & Co. !

Using CCV5 to list articles generated from Emails received, then a CCV5 'Edit Action' to load article into a CFV5 form for Editing / Emailing - all good.

Next, trying to get some DB data into that Email's 'Subject' & 'Body' before sending.

OnSubmit sequence :

OnSubmit > DB Read ( [Data9] = OK ) > Custom Code

Custom Code :

< ? php
$form->data['subject'] = "{Data9.site} | Gift Voucher";
$form->data['voucher'] = "{Data9.voucher} | Gift Voucher Number";
? >

Then > in OnSubmit 'Email' I use 'subject' from Custom Code in dynamic tab field 'subject' & in Email Body I use {voucher} from Custom Code but neither of these outputs values into delivered Email.

As you can see in Array below [subject] & [voucher] are displaying correct values from 'Custom Code' in Array.

------------------------------------------------

OnSubmit Array :

Array
(
[option] => com_chronoconnectivity5
[cont] => lists
[ccname] => voucher-requests
[act] => edit
[Itemid] => 1200
[gcb] => 501
[chronoform] => voucher-requests
[event] => submit
[regrequest] => Array
(
[introtext] => Blar, Blar [Your Name Please] Joe Bloggs
[Your Email Please] joe@home.com
[Phone Number (Optional)] 123456789
)

[emailaddress] => (Dynamic from form = OK)
[button5] => Submit
[Data9] => Array
(
[site] => www.mysite.com
[voucher] => 1234ABCD333
)

[subject] => www.mysite.com | Gift Voucher
[voucher] => 1234ABCD333 | Gift Voucher Number
)

---------------------------------------------------

Debug array :

[3] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully :
[1] => To: joe@home.com
[2] => Subject:www.mysite.com | Gift Voucher
[3] => From name:System
[4] => From email:noreply@system.noreply
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:noreply@system.noreply
[9] => Attachments:
[10] => Array
(
)

[11] => Body:
Hi ! Thanks for your 'Voucher' request. Please find our current 'Voucher Number' Below (This 'Voucher Number' will be valid for 24hr's).

Voucher : 1234ABCD333 | Gift Voucher Number

------------------

Debug shows 'Subject' & 'Body' contain the required data but if I actually send the Email I receive unprocessed values - eg: in 'Subject' I get : {Data9.site} | Gift Voucher & in 'Body' I get : {Data9.voucher} | Gift Voucher Number

Weird Ha - Must be syntax ? Can you advise please !!! - Cheers Paulzero
GreyHead 21 Aug, 2017
Hi Paulzero,

The Sent email should be the same as the Debugger output - unless you have the Email action before the Custom Code actions and the Debugger after them. That might explain what is happening.

Bob
paulzero 22 Aug, 2017
Hi Bob !

Thankz 4 response.

Sequence in 'OnLoad' is :

LoadCSS > LoadJavascript > HTLM Render From > Debugger

Sequency in 'OnSubmit' was :

DB Read > Custom Code > Email > Debugger

Changed 'OnSubmit' order to :

DB Read > Custom Code > Debugger > Email = same result


Still not getting processed output ! Any ideas ? Cheers - Paulzero
GreyHead 22 Aug, 2017
Hi paulzero,

Hmmm if it is correct in the dummy email then it should be correct in the email itself.

Ah - your Custom Code won't work as you can't use the {input_name} syntax in PHP. Please try this instead.
<?php
$form->data['subject'] = "{$form->data['Data9']['site']} | Gift Voucher";
$form->data['voucher'] = "{$form->data['Data9']['voucher']}  | Gift Voucher Number";
?>

Bob
paulzero 23 Aug, 2017
1 Likes
Hi Bob !

Sweet Bro ! All good - working like a charm !

Cheers mate - Paulzero
This topic is locked and no more replies can be posted.