I see an old post http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=1383 that resolves a problem i have but i can do myself. my goal is obtain de cf_id generated when you save the register, but before it occurs in the code boxes or in the emails templates.
The final solution given was something like this
Everything ok in the before sending email box (i needed there) but i could not get it in the email template. I tried in editor an in non editor mode. ¿any help, please?
Thank you one more time
The final solution given was something like this
<?
$cf_id = 0;
$query = "SHOW TABLE STATUS LIKE 'jos_chronoforms_1'";
$result = mysql_query($query) or die ( "Query failed: " . mysql_error() . "
" . $query );
$row = mysql_fetch_assoc($result);
$cf_id = $row['Auto_increment'];
$html_message = str_replace( "#####", $cf_id, $html_message);
?>If you put ##### in your template where you want the cf_id this will work. (I couldn't get it to work with '{cf_id}' as a marker though.)
Everything ok in the before sending email box (i needed there) but i could not get it in the email template. I tried in editor an in non editor mode. ¿any help, please?
Thank you one more time
Hi jaem15,
The last post in tht thread says
here is the code for the current version.
Bob
The last post in tht thread says
This is all very old code from previous versions of ChronoForms. There are several newer threads explaining how to do this with the current release.
here is the code for the current version.
<?php
$MyForm =& CFChronoForm::getInstance('my_form_name');
$cf_id = $MyForm->tablerow['jos_my_table_name']->cf_id;
?>
. . .
<?php echo $cf_id: ?>Bob
So sorry, escuse me, i hadn´t seen the "page 2" of the post ... and now i couldnt find the threads you mentioned... but...
I tries the code you say and now, it even doesnt work in the "before sending email box" (the code before run here). Of course, the template email code doesnt receive de value and i couldnt test my original problem.
The code is this, and nothing is displayed
thank you
I tries the code you say and now, it even doesnt work in the "before sending email box" (the code before run here). Of course, the template email code doesnt receive de value and i couldnt test my original problem.
The code is this, and nothing is displayed
<?
$MyForm =& CFChronoForm::getInstance('inscripciones5');
$cf_id = $MyForm->tablerow['jos_chronoforms_inscripciones5']->cf_id;
echo $cf_id;
?>thank you
Hi jaem52,
It has to go into the Email Template* and the DB Connection has to be set to Before Email.
Bob
* The OnSubmit Before Box code always runs before the DB Connection so won't work.
It has to go into the Email Template* and the DB Connection has to be set to Before Email.
Bob
* The OnSubmit Before Box code always runs before the DB Connection so won't work.
Sorry but i dont understand you very well.
I have this mentioned 3 instructions, in the "onSubmit before box", and then only te echo, the third, in the email template. I need the value in both spaces. ¿something wrong?
Thank you very much.
I have this mentioned 3 instructions, in the "onSubmit before box", and then only te echo, the third, in the email template. I need the value in both spaces. ¿something wrong?
Thank you very much.
Hi,
This code should run AFTER the "Auto generated" code, change the run order the way you want, it just should run after the auto generated code.
Regards,
Max
This code should run AFTER the "Auto generated" code, change the run order the way you want, it just should run after the auto generated code.
Regards,
Max
I changed the run order blocks of the form: 1 pugins,2 autogenerated and 3 Onsubmit, and nothing new happens. I execute the form and this value doesnt appear. i am so sorry but I dont understand.
thank you
thank you
If i dont find a solution i think I will try to come back to first posibility ... at least i can get the cf_id in the on submit box script and i dont know what to do in the email message ...
Hi,
According to the order you posted, can you please check the "DB connection" tab and make sure that the order setting there is set to "after email", and that your cf_id code is under the "on submit AFTER email" code box ?
Regards,
Max
According to the order you posted, can you please check the "DB connection" tab and make sure that the order setting there is set to "after email", and that your cf_id code is under the "on submit AFTER email" code box ?
Regards,
Max
I had the code (i explained post above) in the "OnSubmit before sending". In the tab db connection it is "After email" and in run order tab: "1.plugins 2.submit 3 authogenerated".
Then I changed the code to "On submit after email" box an then i see the cf_id there, but i cant see it in the email template. ufff!!. Sorry but this is getting me crazy.
Thank you very much
Thank you very much
Hi,
Aha, so you need it in the email template ?? then you should set the DB Connection to "before email" and use the same code in the "Email template"
Regards,
Max
Aha, so you need it in the email template ?? then you should set the DB Connection to "before email" and use the same code in the "Email template"
Regards,
Max
So ... ok, in that way it runs.
So, its impossible to have the cf_id value in the "on submit before email box" and in the "email template" simultaneously. Thats what i wanted from the first moment ...
Thank you again
So, its impossible to have the cf_id value in the "on submit before email box" and in the "email template" simultaneously. Thats what i wanted from the first moment ...
Thank you again
Yes, of course, I undestand it in thar point, but it didnt go. Then after this answer by your friend
"Hi,This code should run AFTER the "Auto generated" code, change the run order the way you want, it just should run after the auto generated code.Regards,Max"
Everything changed, and new things appear. I tried a lot of things Max proposed, and finally i get the value cf_id in the box "after" and in the email; but i cant get the value in the box "before" and in the email simultaneously. ... :-((
i know my english is a problem, sorry, and probably a couldnt explain very well my question
Sorry
Thank you by your effort
"Hi,This code should run AFTER the "Auto generated" code, change the run order the way you want, it just should run after the auto generated code.Regards,Max"
Everything changed, and new things appear. I tried a lot of things Max proposed, and finally i get the value cf_id in the box "after" and in the email; but i cant get the value in the box "before" and in the email simultaneously. ... :-((
i know my english is a problem, sorry, and probably a couldnt explain very well my question
Sorry
Thank you by your effort
Hi jaem15,
You can't *ever* get the value of 'cf_id' in the OnSubmit Before box. That code always runs before the DB Connection code which creates the value for 'cf_id'.
Bob
You can't *ever* get the value of 'cf_id' in the OnSubmit Before box. That code always runs before the DB Connection code which creates the value for 'cf_id'.
Bob
I have seen your message, and i had understood. But it didnt work, and another moderator (Max i think) proposed another ways changing order of executing things or putting code in the onsubmit after box. I woult try el lot of these things and i get to obtain the cf_id value in "after code" and "email template" but not in "before box code" and "email" simultaneously.
Thank you a lot
Thank you a lot
Sorry ... my last message was a reply to previous, but i hadnt seen it (2 pages 😶 ) i thought i hadnt have sent the post.
now its evident .. its impossible to have the cf_id in the "before box" ... buff 😢 ... my english is a problem, i tried to ask this in the second or third post, i am sorry.
What i can do is simulate the expected value of the cf_id with the system used in the very first old-solution for the before box. And obtain the real value with the new method generating it in the after box for display it in the email template. So, i probably can mix two methods to obtain the value in the previous box and in the email template.
Excuse me and i am grateful for your effort
now its evident .. its impossible to have the cf_id in the "before box" ... buff 😢 ... my english is a problem, i tried to ask this in the second or third post, i am sorry.
What i can do is simulate the expected value of the cf_id with the system used in the very first old-solution for the before box. And obtain the real value with the new method generating it in the after box for display it in the email template. So, i probably can mix two methods to obtain the value in the previous box and in the email template.
Excuse me and i am grateful for your effort
Hi Jaem52,
That helps, thank you.
Why do you need the cf_id in the OnSubmit Before box?
Bob
That helps, thank you.
Why do you need the cf_id in the OnSubmit Before box?
Bob
its a good question 🙂
In this form when the user send data, i have to evaluate some value fields, and in one case i make a submit using a hidden code form posted to a bank virtual terminal in order to pay (an inscription to a teachers meeting) which price is evaluated in another field too. Only some cases have to pay something. In one of this hidden form field posted to the bank i have to give an unique operation number and i thought using the cf_id because is unique and associate to the record, to the user is saved.
Probably putting this code in the "after box" is the same for me, but i was inspirate in one example that uses it in the "on submit before".
I had the hope that i could cancel the record saving, in some case using this "before code box" ... but i dont know how and now i think i cant. Isnt it?
By the other hand i was curious to know if it was possible, and now i understand a little better the process of "code" in chronoforms (not completely). Is there a graphic or a manual that explain the flow of the operations in the chronoform code boxes?.
I really would like to explain all this in my language 😢
Thank you one more time ...
In this form when the user send data, i have to evaluate some value fields, and in one case i make a submit using a hidden code form posted to a bank virtual terminal in order to pay (an inscription to a teachers meeting) which price is evaluated in another field too. Only some cases have to pay something. In one of this hidden form field posted to the bank i have to give an unique operation number and i thought using the cf_id because is unique and associate to the record, to the user is saved.
Probably putting this code in the "after box" is the same for me, but i was inspirate in one example that uses it in the "on submit before".
I had the hope that i could cancel the record saving, in some case using this "before code box" ... but i dont know how and now i think i cant. Isnt it?
By the other hand i was curious to know if it was possible, and now i understand a little better the process of "code" in chronoforms (not completely). Is there a graphic or a manual that explain the flow of the operations in the chronoform code boxes?.
I really would like to explain all this in my language 😢
Thank you one more time ...
Hi jaem52,
Ok, now I understand. I prefer not to use the cf_id as an identifier as it is possible to 'guess' what other values might be. Instead I use a unique random string, that can be generated in the OnSubmitBefore box and saved to the table along with the other values.
You will find the code I use in this article (you don't need the barcode part though).
Bob
Ok, now I understand. I prefer not to use the cf_id as an identifier as it is possible to 'guess' what other values might be. Instead I use a unique random string, that can be generated in the OnSubmitBefore box and saved to the table along with the other values.
You will find the code I use in this article (you don't need the barcode part though).
Bob
This topic is locked and no more replies can be posted.
