Forums

add text to email in "On Submit code - before sending email"

ludo007 28 Nov, 2011
Hi,
I want to create a personnal identifier for my forms and i create this identfier in the section " On Submit code - before sending email" but i want to insert a line in my email template with this identifier so i want to know how to append an html text to the email to be send or does it exist any other method.

PS: sorry for my english i speak french
GreyHead 28 Nov, 2011
Hi ludo007,

if you add the new variable to the $_POST array with JRequest::setVar() then I think you should be able to use the value in your email template.

Bob
ludo007 28 Nov, 2011
Thanks a lot, the value pass to the email and i can access it. But now i have a problem, in my code i want to access to the cf_id of the form instance, i setup the DbConnection and put it before the mail and my code is in the section "On Submit code - before sending email". The value of cf_id is not fill. That is my code


$MyForm =& CFChronoForm::getInstance('my_form_name');
$itemid = $MyForm->tablerow["my_chronoforms_tablename"]->cf_id;


and the value of $itemid is already blank. Thanks
GreyHead 29 Nov, 2011
Hi ludo007,

There are several threads here talking about the cf_id question. My recollection is that you can't do it the way you are trying because of the execution order in ChronoForms.

My preference is to create a random string identifier for the new record before the DB Connection and use that as a record identifier.

Bob
ludo007 29 Nov, 2011
ok!!! that's so disobliging

I think about another solution, if i put my code in the section "On submit code - After sending email" i will access the value of the cf_id. how can i send another email (ever in the section "On submit code - After sending email") with this value. i think about a using the API but don't know the code to use.
This topic is locked and no more replies can be posted.