It is useful to use the Append text functionality to multiline text fields in SharePoint, but it is difficult to optimize the display of these entries in a SharePoint view. Using a content editor web part, however, it is possible to create a text box which will display the contents of the multiline text field in a box when the user hovers over an appropriate link.

To use this technique, add a Content Editor Web Part to the page with your view, below the view itself and place the following code in the source:

<script type=”text/javascript” src=”/test/English/Javascript/jquery-1.3.2.min.js”></script>

<script type=”text/javascript” src=”/test/English/Javascript/Preview_DispForm_metadata.js”></script>

<script type=”text/javascript”>

hoverImg = ‘/_layouts/images/OPENDB.GIF’;

hoverImgDescription = ‘Hover mouse over this image to preview the metadata’;

arrOfFieldsToShow = [‘MultilinePlainText’];

prependHoverImageTo = ‘MultilinePlainText’; // If “append-field” insert FieldInternalName here

</script>

You will need to insert the correct path to the two JavaScript files which are required and replace MultilinePlainText with the name of your text field.

You will also need two resource JavaScript files, Preview_DispForm_metadata.js, written by Alexander at http://sharepointjavacript.wordpress.com who is the author of these techniques. The other is the jquery file.

The custom JavaScript is available from:

http://sharepointjavascript.wordpress.com/2009/11/17/preview-metadata-in-list-view-on-mouseover/

 

Advertisements