Jump to content
Master

Inlcude non-blank values only in email body

Recommended Posts

If there is no specific formatting for the email, you can add a virtual field, make it hidden and use the code below to assign non-blank values to a virtual field and then use it as your email body

 

<script>
document.getElementById('caspioform').onsubmit = function (){
var mylist = new Array("EditRecordFirst_Name", "EditRecordLast_Name", "EditRecordDOB", "EditRecordAge", "EditRecordDescription");
var email= '';

for (var i=0; i< mylist.length;i++){

if (document.getElementById(mylist[i]).value){
email = email + ',  ' +mylist[i].substring(10) + ": "+  document.getElementById(mylist[i]).value;

}
}
document.getElementById('cbParamVirtual1').value = email;
}

</script>

 

 

This is for update/details page for submission page you need to change EditRecord to InsertRecord

 

var mylist = new Array("InsertRecordFirst_Name", "InsertRecordLast_Name", "InsertRecordbutton", "InsertRecordAge", "InsertRecordDescription");

And change all the field names with your field names.

Also you need to change this line to:

email = email + ',  ' +mylist[i].substring(11) + ": "+  document.getElementById(mylist[i]).value;

Since InsertRecord is 11 characters and we want to only get the word after that for the label

Share this post


Link to post
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...