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.
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.
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']
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.
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
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!
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