Jump to content

Send an automatic email to more than one field name


Recommended Posts

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?

Link to comment
Share on other sites

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;

:)

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...