I have a form working and all of the information is being submitted properly to the database. After the DBSave, I would like to send cf_uid to the user as a part of the e-mail template. I've read the tutorials and searched the forum without any luck. When I add the following line to my email template:
Your key is: {cf_uid}, the actual cf_uid does not show up.
Do I need to add a hidden field to my form to access the cf_uid? Perhaps there is a better way that you can recommend?
Thanks for your help.
Your key is: {cf_uid}, the actual cf_uid does not show up.
Do I need to add a hidden field to my form to access the cf_uid? Perhaps there is a better way that you can recommend?
Thanks for your help.
Hi jsimkav,
After the DB Save the saved data is available in $form->data['chronoform_data']*, so the cf_uid should be in $form->data['chronoform_data']['cf_uid']
Bob
* If you have set another Model ID in the DB Save then 'chronoform_data' will be replaced by your Model ID.
After the DB Save the saved data is available in $form->data['chronoform_data']*, so the cf_uid should be in $form->data['chronoform_data']['cf_uid']
Bob
* If you have set another Model ID in the DB Save then 'chronoform_data' will be replaced by your Model ID.
Thank you for your response GreyHead. I'm still unclear where I add the code that you mentioned. I have not changed the Model ID. When I inserted the code into my e-mail template the results are still the same. See screenshot of my template. I tried with and without curly braces. I've attached a screenshot of the template.
Here is how my template tab looks:
A new user has signed up:
First Name: {First_Name}
Last Name: {Last_Name}
Phone Number: {Phone_Number}
Email Address: {Email_Address}
Source: {Dropdown}
Libraries: {Code_Libraries}
Features: {Features}
Use: {Intended_Use}
Opt-In: {Send_Updates}
User API Key: {$form->data['chronoform_data']['cf_uid']}
The email results in:
First Name: Joe
Last Name: Smith
Phone Number: 9999999999
Email Address: [email]test@test.com[/email]
Source: Google
Libraries: Ajax
Features: JSON
Use: Web
Opt-In: No
User API Key: $form->data['chronoform_data']['cf_uid']
Here is how my template tab looks:
A new user has signed up:
First Name: {First_Name}
Last Name: {Last_Name}
Phone Number: {Phone_Number}
Email Address: {Email_Address}
Source: {Dropdown}
Libraries: {Code_Libraries}
Features: {Features}
Use: {Intended_Use}
Opt-In: {Send_Updates}
User API Key: {$form->data['chronoform_data']['cf_uid']}
The email results in:
First Name: Joe
Last Name: Smith
Phone Number: 9999999999
Email Address: [email]test@test.com[/email]
Source: Google
Libraries: Ajax
Features: JSON
Use: Web
Opt-In: No
User API Key: $form->data['chronoform_data']['cf_uid']
Hi jsimkav ,
If you want to use PHP in the template then it must be in PHP tags
Bob
If you want to use PHP in the template then it must be in PHP tags
User API Key: <?php echo $form->data['chronoform_data']['cf_uid']; ?>
I'm not sure if this will work but worth a try. If it doesn't then please post again and I'll run a test.Bob
No go. When I added the php code to the template the User API Key is now blank.
The email results in:
First Name: Joe
Last Name: Smith
Phone Number: 9999999999
Email Address: [email]test@test.com[/email]
Source: Google
Libraries: Ajax
Features: JSON
Use: Web
Opt-In: No
User API Key:
Not sure if this is useful or not but when I add User API Key: <?php echo 'hello'; ?> the User API Key is populated in the e-mail with "User API Key: hello" as expected.
The email results in:
First Name: Joe
Last Name: Smith
Phone Number: 9999999999
Email Address: [email]test@test.com[/email]
Source: Google
Libraries: Ajax
Features: JSON
Use: Web
Opt-In: No
User API Key:
Not sure if this is useful or not but when I add User API Key: <?php echo 'hello'; ?> the User API Key is populated in the e-mail with "User API Key: hello" as expected.
Hi jsimkav,
Then it looks as though $form->data['chronoform_data']['cf_uid'] has no value at this point in the work-flow.
What actions do you have in the OnSubmit Event?
Bob
Then it looks as though $form->data['chronoform_data']['cf_uid'] has no value at this point in the work-flow.
What actions do you have in the OnSubmit Event?
Bob
Hi Bob,
So I now have the e-mail working as expected. I checked the data and realized that cf_uid was not being populated with a value as you mentioned. I changed my DBSave action to "yes" to save under this model id and now the e-mail shows all values. Great.
Now I have a new problem, the data from my form is not being saved to the database now. If I set "save under modelid" back to NO, all of the form data is saved to the database (without cf_uid) but the e-mail does not contain the cf_uid.
On Submit - Check Captcha, Handle Arrays, DBSave, E-mail, Show Thanks.
I noticed the tip "Should we save the data coming under ths Model ID ONLY ? if yes then your data array should include some array of values under a key name equals your model_id value or no form data will be saved" but I can't figure out what I need to change so all of my data is saved with a CF_UID and the E-Mail contains the CF_UID.
Thank you for your help!
So I now have the e-mail working as expected. I checked the data and realized that cf_uid was not being populated with a value as you mentioned. I changed my DBSave action to "yes" to save under this model id and now the e-mail shows all values. Great.
Now I have a new problem, the data from my form is not being saved to the database now. If I set "save under modelid" back to NO, all of the form data is saved to the database (without cf_uid) but the e-mail does not contain the cf_uid.
On Submit - Check Captcha, Handle Arrays, DBSave, E-mail, Show Thanks.
I noticed the tip "Should we save the data coming under ths Model ID ONLY ? if yes then your data array should include some array of values under a key name equals your model_id value or no form data will be saved" but I can't figure out what I need to change so all of my data is saved with a CF_UID and the E-Mail contains the CF_UID.
Thank you for your help!
Hi jsimkav,
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
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
Hi jsimkav,
I found the answer. Because you have a hidden input in your form named 'cf_uid' ChronoForms asssumes that you want to use the value of this rather than create a new value. So, when the value is '' that what is saved into the database table.
The fix is to add a Custom Code action before the DB Save and to unset the variable if it is empty.
Bob
I found the answer. Because you have a hidden input in your form named 'cf_uid' ChronoForms asssumes that you want to use the value of this rather than create a new value. So, when the value is '' that what is saved into the database table.
The fix is to add a Custom Code action before the DB Save and to unset the variable if it is empty.
<?php
if ( isset($form->data['cf_uid']) && $form->data['cf_uid'] == '' ) {
unset($form->data['cf_uid']);
}
?>
Then the existing value of Cf_uid is used if there is one in the form otherwise a new value is created and saved.Bob
Thnx!! finally found a solution on this forum :mrgreen: This is precise what i needed in my email 😀 i use the cf_uid in the email as url to go back to the form with the data so it can be changed after. :mrgreen:
Bob
Hi jsimkav ,
If you want to use PHP in the template then it must be in PHP tags
User API Key: <?php echo $form->data['chronoform_data']['cf_uid']; ?>
I'm not sure if this will work but worth a try. If it doesn't then please post again and I'll run a test.Bob
This topic is locked and no more replies can be posted.