Forums

Variable in email template not showing

greenbox 13 May, 2013
Hi,
I have problem with putting custom generated variable with custom string in to email template.
Simply the call of {test} shows nothing in email.
My variable is putted in to $form->data['test'] = 'test'; on custom code in On submit section, and it shows on pring_r($form->data), but not in email template.
I have no idea what is wrong ....😢
Please help 😟
I have CF 4RC on J2.5

/* On sumbmit -> Custom code before Email */
<? 
$form->data['test'] = 'test';
?>

and another customcode after email call

<? print_r($form->data); ?>

result

Array
(
)
Array ( [chronoform] => zgloszenie [event] => submit [Itemid] => 508 [option] => com_k2 [view] => item [layout] => item [83ba85e2ce1244f1f6ce1b272c4c4688] => 1 [test] => test )
GreyHead 13 May, 2013
Hi greenbox,

Is the Custom Code action *before* the Email action?

Do you have {my_var} in the Email template?

Bob
greenbox 13 May, 2013
Yes i have {} brackets in email template, i try diffrend way but still with no success, please see my updated post.
I think that the custom variables are some how removed, because when i deactivate remove nulls from email action it shows {test}
GreyHead 13 May, 2013
Hi greenbox,

What exactly is in the email template?

Bob
greenbox 13 May, 2013
Now i have only
{test}

and in recived email is also {test} not self test form {test} variable ;-)
GreyHead 13 May, 2013
Hi greenbox,

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
GreyHead 13 May, 2013
Hi greenbox,

You have the Mode of the Custom Code action set to View instead of Controller so it doesn't execute where you need it to. Please switch this back and all should be OK.

Bob
greenbox 13 May, 2013
Thank you so much Bob, now everything is fine. :mrgreen:
Now i understand where the error was 🙂
This topic is locked and no more replies can be posted.