Buy Now
Sign in

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

paulzero , August 21 2017, 08:05
P
paulzero 27
August 21 2017, 08:05 #371520
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 64
August 21 2017, 14:09 #371526
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
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
P
paulzero 27
August 22 2017, 11:18 #371549
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 64
August 22 2017, 13:40 #371556
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
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
P
paulzero 27
August 23 2017, 01:02 #371569
 1
Hi Bob !

Sweet Bro ! All good - working like a charm !

Cheers mate - Paulzero