How to implement a 'MailTo' Link (html format) in a calculated Column in SharePoint List
For example if you want to show an email link if the category (another column value say AppType) is 'On-Request', and by clicking on that you can open an outlook window to send a request email.
But you don't want to show the full 'href' link instead just a text "Request" with an html link that will trigger the email. In that case you can use the following method.
Create a calculated column (say 'Request' for request email).
Add a content editor web part to the list page and add the following JavaScript.
<SCRIPT type=text/javascript>
if(typeof jQuery=="undefined"){
var jQPath ="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/";
document.write("<script src='",jQPath,"jquery.min.js' type='text/javascript'><\/script>");
}
</SCRIPT>
<SCRIPT type=text/javascript>
$(document).ready(function(){
$(".ms-vb2:contains('<DIV')").each(function(){
var tempDIV = document.createElement ("DIV");
tempDIV.style.cursor = "pointer";
tempDIV.innerHTML = $(this).text();
$(this).text("");
$(this).append(tempDIV);
});
});
</SCRIPT>
Now give the following code as value for the calculated column you created:
=IF([App Type]="On-Request","<DIV><a href='mailto:dinoop@website.com?Subject=Testing'>Request</a></DIV>","")
Now you can see column values as html links.
The JavaScript function will convert the text to html wherever it finds the 'DIV' tag.