Master Posted July 7, 2017 Report Share Posted July 7, 2017 How can I only include non-blank values in email body? Quote Link to comment Share on other sites More sharing options...
MayMusic Posted July 7, 2017 Report Share Posted July 7, 2017 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 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.