TannerCarter Posted October 14, 2011 Report Share Posted October 14, 2011 For each record submitted, I want to send an automatic email to three different emails that will vary based on the fields entered in the submission form. On the Acknowledgement email, I can do this with only one field name. On the Notification email, I can't use field names in the "To:" section. Is there any way to do this? Quote Link to comment Share on other sites More sharing options...
Aariel Posted October 14, 2011 Report Share Posted October 14, 2011 hi, It is a javascript .....As I understand, you have couple of email fields in your submission form. And you want to send email to all the emails entered. You can concatenate the field and send the final concatenated value as an email field in Acknowledgement email. For this, the steps can be: 1) create a virtual field (suppose Virtual1) 2) Insert Header and Footer in Configure Field Wizard. 3) write the following Javascript in your footer. Note: email1, email2, email3 needs to be substituted with your email field. If you have more than three email fields, you can add more variables and proceed accordingly. If your virtual field is not called Virtual1 replace the name accordingly. You can hide the virtual field as explained in http://howto.caspio.com/customization/h ... pages.html . function calculate() { var e1= document.getElementById("InsertRecordemail1").value; var e2 = document.getElementById("InsertRecordemail2").value; var e3 = document.getElementById("InsertRecordemail3").value; var com_email = e1+";"+e2+";"+e3; document.getElementById("cbParamVirtual1").value = com_email; } document.getElementById("caspioform").onsubmit=calculate; Quote Link to comment Share on other sites More sharing options...
TannerCarter Posted October 17, 2011 Author Report Share Posted October 17, 2011 Thank you so much for your help. For some reason, though, I am still having trouble getting this to work. I am new to Caspio and unfamiliar with Javascript, so bear with me... I just copied your code into the footer and changed the three email fields to the names of my three email fields. I am using Virtual1 as my virtual field, so I didn't have to change that. I then selected Virtual1 as the field for the acknowledgement email. I do have my submission form set to accept parameters. Does "caspioform" used in the code need to change to something else or is that standard? I have tested the acknowledgement using one of my email fields and it works. It just doesn't work when I use the Virtual1 field. I have reviewed everything and don't know what I am missing. Any help would be greatly appreciated! Quote Link to comment Share on other sites More sharing options...
Aariel Posted October 18, 2011 Report Share Posted October 18, 2011 hi, Do you have any other Caspio DataPage deployed on the same web page? If No, please put the alert statement after the line: document.getElementById("cbParamVirtual1").value = com_email; i.e: ...... document.getElementById("cbParamVirtual1").value = com_email; var all_email= document.getElementById("cbParamVirtual1").value; alert('all email='+all_email); } .... When you submit the web form, a message will pop up. Please see if it shows you combination of all emails. If you want, you can send your web page link. This will help me debug and see if any script error is there. Quote Link to comment Share on other sites More sharing options...
TannerCarter Posted October 18, 2011 Author Report Share Posted October 18, 2011 I am using the Direct from Caspio deployment. Quote Link to comment Share on other sites More sharing options...
Aariel Posted October 18, 2011 Report Share Posted October 18, 2011 hi, i tried with direct deploy URL. It is working for me. Can you paste the code that you have in footer. Quote Link to comment Share on other sites More sharing options...
TannerCarter Posted October 19, 2011 Author Report Share Posted October 19, 2011 function calculate() { var e1 = document.getElementById("InsertRecordABS_Email").value; var e2 = document.getElementById("InsertRecordHauler_Email").value; var e3 = document.getElementById("InsertRecordDestination_Email").value; var com_email = e1+";"+e2+";"e3; document.getElementById("cbParamVirtual1").value = com_email; var all_email= document.getElementById("cbParamVirtual1").value; alert('all email='+all_email); } document.getElementById("caspioform").onsubmit=calculate; One other thing... On submit, this datapage does open another datapage and passes an autonumber parameter to that page. Thanks for your continued help. Quote Link to comment Share on other sites More sharing options...
Aariel Posted October 19, 2011 Report Share Posted October 19, 2011 hi, I see that one '+' is missing. You have: var com_email = e1+";"+e2+";"e3; Instead of var com_email = e1+";"+e2+";"+e3; Hope it helps. And does the alert worked? do you see anything similar to the screenshot as below when you hit 'Submit'... Quote Link to comment Share on other sites More sharing options...
TannerCarter Posted October 20, 2011 Author Report Share Posted October 20, 2011 Because my email fields were selected on the datapage from dropdowns, the following changes were needed to make it work for me. Thanks again for all your help. function calculate() { var e1 = document.getElementsByName("InsertRecordABS_Email")[0].value; var e2 = document.getElementsByName("InsertRecordHauler_Email")[0].value; var e3 = document.getElementsByName("InsertRecordDestination_Email")[0].value; var com_email = e1+"; "+e2+"; "+e3; document.getElementById("cbParamVirtual1").value = com_email; var all_email= document.getElementById("cbParamVirtual1").value; } document.getElementById("caspioform").onsubmit=calculate; Quote Link to comment Share on other sites More sharing options...
Aariel Posted October 20, 2011 Report Share Posted October 20, 2011 hi, Great to hear that you made it work. Thank you for update. Just curious, is it a dropdown or cascading dropdown? Quote Link to comment Share on other sites More sharing options...
TannerCarter Posted October 20, 2011 Author Report Share Posted October 20, 2011 Cascading. Quote Link to comment Share on other sites More sharing options...
Aariel Posted October 21, 2011 Report Share Posted October 21, 2011 Thank you. Since cascading gets dynamic Id everytime, we have to use this element by Name i.e: document.getElementsByName . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.