Everybody talks




September 4, 2012 —  (Page 1 of 2)
The great thing about having children is being pseudo-tuned in to pop culture. As I got into the car with my teenager the other day, we commenced our daily battle for control of the radio. Since I was driving and paying attention to the road, he won and I was hostage to his musical whims. This song came on, which is the title of this article, and it was catchy. My mind, never far from SharePoint, played the title over and over. Later that day, as I was working to make a few technologies work together, it clicked. Several lessons ensued.

The item I was trying to make work is a commonly requested feature: When a user clicks on an e-mail link in a list of articles and has the default e-mail reader pop up with passed-in information in the subject and body. The answer on how to do this is use XSL, JavaScript and Mailto.

Everybody talks. Here was my first issue:

The e-mail image is wrapped in an href attribute embedded with a JavaScript call that would eventually have two parameters. The XSL code was similar to this:
<a><xsl:attribute name=”href”>javascript:SendEmail(<xsl:value-of select=”@Link”/>);</xsl:attribute><img src=”source”/></a>

How to pass a link to JavaScript. This should be easy, except that the folks who wrote the site before me did not create their lists/libraries without spaces. While I have a lot of pet peeves, one of the only things I am anal about in SharePoint is creating anything without the _0x200_, otherwise known as a space. Create columns, lists or libraries without spaces. Put the space in after the object is created.

The answer to the first issue was to add single quotes around the @Link. However, you cannot just place quotes there. You have to use a concat statement and the representation of quotes. After some research, I got the following to work:
<xsl:value-of select=”concat(‘&quot’,@Link,’&quot;’)”/>

Everybody talks. XSL was speaking to JavaScript and passing in the link. To render the default reader, I used the Mailto functionality. Mailto is an Internet standard: RFC 2368. The problem with Mailto is that is only renders text, not HTML. This is a big issue because I was passing in a link I wanted to be clickable. It was rendering as follows: http://www.domain.com/HMC Document/article1.aspx


Pages 1 2 


Share this link: http://www.sptechweb.com/link/36918

 
 
This site's content Copyright © 1999 - 2013 by BZ Media LLC, All rights reserved.
Legal and Privacy
Phone: +1 (631) 421-4158 • E-mail: info@bzmedia.com