Forums

Display the automatic generated form id

itenbrink 01 Jul, 2009
I try to display the ID which is generated for each submitted form in an eMail.
All other Fields can be show but the field cf_id is not shown....
Max_admin 02 Jul, 2009
Hi itenbrink,

first your data save order should be "before email", this is under the DB Connection tab!

next your email template should be with no editor to add this PHP code:


<?php
echo $MyForm->tablerow["jos_chronoforms_table_name"]->cf_id; // change the table name!

?>


Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
itenbrink 03 Jul, 2009
:D
Wonderful! Maybe I should learn php, that could save hours.
Thank you it works fine!
:D
jnobel 22 Feb, 2010
Hi,

I tried to use this piece of code in an email template:

<?php
echo $MyForm->tablerow["jos_chronoforms_table_name"]->cf_id;
?>

However once I have saved, the PHP code is changed (even editing in HTML mode) into:
tablerow["jos_chronoforms_table_name"]->cf_id;?>

It seems to be the Editor that does this, since it is already changed when I exit the HTML source editor. Does this mean php code in email templats no longer works?
GreyHead 22 Feb, 2010
Hi jnobel,

next your email template should be with no editor to add this PHP code:

Turn it off in the Email Setup Properties box.

Or better put the value into the $_POST array in the OnSubmit Before box with
<?php
JRequest::setVar('cf_id', $MyForm->tablerow["jos_chronoforms_table_name"]->cf_id);
?>
and then use {cf_id} in the template.

Bob
jnobel 22 Feb, 2010
Hi GreyHead,

Thanks for the suggestions, It was very late last night, turning off the template editor did not come to my mind. Unfortunately part of the php statement is still stripped, perhaps by another part of the system.
It appears that <?php echo $MyForm-> is seen as an invalid tag or something like that, since that is the part that is missing from the statement.
The other suggestion (setting the POST variable) does not yield any result. {cf_id} appears to be empty once it reaches the email step. Ì tried with both settings for the order of Email / Storage.

Strange ....
GreyHead 22 Feb, 2010
Hi jnobel,

Nothing *should* be stripped if the template editor is off.

You will need to set the DB Connection to 'Before Email' so that the cf_id has been generated before you try to use it.

Bob
jnobel 04 Mar, 2010
Thanks Greyhead,

I forgot to mention that it works now. I thought I'd tried every combination.
Turns out I confused two forms and put the code you suggested in one form and set the "before Email" setting in the other form. Must have been because it was so late...

Thanks again.
Johan
This topic is locked and no more replies can be posted.