Mathilda Posted May 1, 2017 Report Share Posted May 1, 2017 Hi everyone, I just want to share this solution. If you need to generate notification emails to email addresses selected in a list datatype, you need to: - add a virtual field; - select a virtual field in the field "to" when you set-up notification email; - insert the following script in the footer and replace list_of_emails with name of your list datatype field: <script> function ListToVirtual() { var ListValue = document.getElementsByName('ComboBoxInsertRecordlist_of_emails')[0].value; var VirtualValue = document.getElementById('cbParamVirtual1'); VirtualValue.value = ListValue; var str = document.getElementById("cbParamVirtual1").value; var res = str.replace(/,/gi, ";"); document.getElementById("cbParamVirtual1").value = res; } document.getElementById("caspioform").onsubmit=ListToVirtual; </script> Quote Link to comment Share on other sites More sharing options...
MayMusic Posted July 3, 2017 Report Share Posted July 3, 2017 Thanks for sharing Mathilda Quote Link to comment Share on other sites More sharing options...
SongLian Posted July 27, 2017 Report Share Posted July 27, 2017 Hi Mathilda, Can your solution be modified to do send notifications to multiple email addresses? I was trying out your solution, but realised that my email address is using text and not list datatype. What I'm trying to accomplish is to email to all the employees of selected companies based on user selection. However, Caspio does not support this and they recommended me to use bulk editing as a work around, It works but it requires extra steps and also extra datapages. I need a more elegant solution for my project. Thanks Quote Link to comment Share on other sites More sharing options...
Mathilda Posted August 1, 2017 Author Report Share Posted August 1, 2017 On 7/27/2017 at 7:06 AM, SongLian said: Hi Mathilda, Can your solution be modified to do send notifications to multiple email addresses? I was trying out your solution, but realised that my email address is using text and not list datatype. What I'm trying to accomplish is to email to all the employees of selected companies based on user selection. However, Caspio does not support this and they recommended me to use bulk editing as a work around, It works but it requires extra steps and also extra datapages. I need a more elegant solution for my project. Thanks Hi, I took a solution from this post and added a small script which will replace commas with semi column. Here is script which should be in the header: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> window.onload = function multiselect() { var a = document.getElementsByTagName('select'); var index; for (index = 0; index < a.length; ++index) { if (a[index].size!==0) { a[index].multiple=true; } } } </script> And the following script should be in the footer: <script> $('[name=cbParamVirtual2').change(function() { $('[name=cbParamVirtual3').val($('[name=cbParamVirtual2').val()) }); </script> <script> function replace(){ var res= document.getElementsByName('cbParamVirtual3')[0].value; document.getElementsByName('cbParamVirtual3')[0].value=res.replace(",", "; "); } document.getElementById("caspioform").onsubmit=replace; </script> In my script Virtual field2 is a cascading element, Virtual field 3 is an additional field which should be used in the To field in email. Hope that helps Quote Link to comment Share on other sites More sharing options...
SongLian Posted August 11, 2017 Report Share Posted August 11, 2017 Hi Mathilda, Thanks, finally it is working now.. Quote Link to comment Share on other sites More sharing options...
SongLian Posted August 15, 2017 Report Share Posted August 15, 2017 Hi Mathilda, Just found that there is still one problem with the script, the script works when 2 emails are selected, however, when I have 3 or more emails selected, the subsequent emails were not being sent as the divider between email was not replaced with semicolon Please refer to the example of emails that I've managed to captured below, as you can see, only the 1st and 2nd email was replaced with semicolon but not the subsequent emails. tansonglian@gmail.com; tansonglian@yahoo.com,xxx@yahoo.com,song.lian.tan@recgroup.com Appreciate if you can help to amend the script. Thanks in advance Quote Link to comment Share on other sites More sharing options...
Mathilda Posted August 29, 2017 Author Report Share Posted August 29, 2017 On 8/15/2017 at 7:44 AM, SongLian said: Hi Mathilda, Just found that there is still one problem with the script, the script works when 2 emails are selected, however, when I have 3 or more emails selected, the subsequent emails were not being sent as the divider between email was not replaced with semicolon Please refer to the example of emails that I've managed to captured below, as you can see, only the 1st and 2nd email was replaced with semicolon but not the subsequent emails. tansonglian@gmail.com; tansonglian@yahoo.com,xxx@yahoo.com,song.lian.tan@recgroup.com Appreciate if you can help to amend the script. Thanks in advance Hi SongLian, I changed code for the footer, it should work now: <script> $('[name=cbParamVirtual2').change(function() { $('[name=cbParamVirtual3').val($('[name=cbParamVirtual2').val()) }); </script> <script> function replace(){ var res= document.getElementsByName('cbParamVirtual3')[0].value; var newchar = '; ' res = res.split(',').join(newchar); document.getElementsByName('cbParamVirtual3')[0].value=res; } document.getElementById("caspioform").onsubmit=replace; </script> SongLian 1 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.