Troubleshooting your “HTML calculated column”

The purpose of this post is to help readers who are having trouble implementing my “HTML calculated column” method. Below are some of the most common issues.

SharePoint returns an error message when you create your calculated column
– Do not directly copy/paste the formulas from my blog. Use “copy to clipboard” when available, otherwise type it directly in the formula field of your calculated column.
– Start by implementing one of my examples as is. Choose for example the indicator, which works on a standard issues list.
– You can use the “Edit in Datasheet” option to edit your formulas. In datasheet mode, SharePoint provides some context help.

The formula works, but it is rendered as is, not as HTML
– Remember that the formula itself does nothing, you also need the script, provided through a CEWP placed in your page.
– Do not put the script in the text editor of the CEWP. You can either put it in the source editor, or (recommended) put it in a separate text file and link to it from the CEWP.
– The CEWP must be placed AFTER the list on the page.
– The CEWP is needed on every page where you need to render the HTML.

You don’t know the syntax for SharePoint formulas
You can find some useful references in this post.

The HTML is not rendered correctly
You may have a syntax error in your HTML, double check your opening and closing quotes, as well as semi-colons in styles.
For Firefox, do not forget the non-breaking space when needed (see my posts for examples).

Getting help
If you cannot get the method to work, you have two ways to ask for advice:
– post your question in the comments section. To post code, use the following syntax:

106 thoughts on “Troubleshooting your “HTML calculated column”

  1. Pingback: Using calculated columns to write HTML « Path to SharePoint

  2. Pingback: SharePoint calendars: color coding, hover effects, etc. « Path to SharePoint

  3. Did you try the “Edit in datasheet” method, as mentioned in this post? It may help you if your formula is not correct.
    I did a quick size test, and the maximum length I was allowed to enter in a formula was 854 characters…

  4. I’ve tried everything but always get a syntax error when I try to save the calculated column.

    What am I missing? Does this require MOSS?

  5. This works for any SharePoint (wss 2, wss 3, MOSS).

    Syntax error simply means that the formula in your calculated column is not correct. Check your quotes, parentheses, column names.

  6. Is there a way to use HTML and CSS in the Datasheet view of a list as well. Your scripts for Calendar and normal Lists have worked great. Can’t thank you enough. I’m just trying to get the column contents to center correctly.

  7. Aaron,
    You can apply styles for your columns if you want to use the SP UI, else you can edit the datasheet view and make many more changes.

  8. Hi,
    I posted under a Color Coding -More examples, not knowing the trick to post code. Please delete those postings(2)

    I’m trying to use our images in the calculated field with an IF statement. It works great when using • not a problem but this formula just dispays as text. Can you help me out?

    ="<div><img src='/hq/SiteCollectionImages/Bullets%20and%20Icons/Icons/"&IF(&#91;Travel Category&#93;="MILAIR","navywings.jpg'> ","airplane32x32.jpg'>")&"</div>"
    

    the column displays as text even though I have the CEWP with the text to html javascript loaded at the bottom of the list page.

    Here is what is displayed:

    <div><img src='/hq/SiteCollectionImages/Bullets%20and%20Icons/Icons/navywings.jpg'> </div>
    

    The logic works but the images do not render.
    I’ve tried different combinations and placement of quotes but can’t seem to hit on the correct syntax.

    Can anyone help?

    Thanks,
    Judith

  9. Judith: here are some possible reasons why it doesn’t work:
    – you’re using capital letters in the script – DIV – but small letters in the formula – div
    – a / is missing to close your img tag

    Hope this helps.

  10. Thanks Christopher…it was the lower case vs upper case in the tags. When I changed the and in the calculated field to uppercase it worked.

    The javascript in the CEWP was searching for the “” and could not find it because it was lower case.

    Good catch. Its always better to have another pair of eyes!

    Judith
    (didn’t need to close the img tag)

    • I am trying to create a color coded list in Sharepoint for Issues, and risks tracking.

      I want the value in the column ‘Traffic Light’ to be displayed as a bullet point ( red, green or gold depending upon the choice selected in the column ‘Priority”).

      Following your example on the website I did the following steps:
      1. Created a column named ‘Priority’ with choice option : 1.High 2. Medium 3) Low.
      2. Created a calculated column named ‘Traffic Light’ and entered the formula =CHOOSE(RIGHT(LEFT(Priority,2),1),”red”,”gold”,”limegreen”)
      3. Added the content editor web part
      4. Copied the code( clipboard)
      5. Entered the code in the source code
      Can you please suggest what is it I am missing as it still does not display the colour coded bullets, but just the text ‘red’, ‘limegreen’ and ‘gold’

  11. Ok still trying to get this towork:

    1. Copied the code for calendars to a CEWP
    2. Added two columns to my calendar
    One for a type of event ( only three right now)
    another calculated column with the input from the formula generator
    3. added the CEWP to webpage.

    No luck, the formula generator shows as text in my caluculated colomn. What am I doing wrong?

    • Dave: for calendars, I recently changed the code. In the formula generator you need to replace the two “DIV” with “SPAN”.
      Sorry, I still need to find time to update my site…

      • Ok let me make sure I got this right. I updated the new CEWP web part that has the SPAN tag in it. I then changed the formula from DIV to SPAN. Put both on the page with the calendar. Still not working.
        Maybe I am doing the calendar wrong. I added two columns to the calendar. One was the Type of event as a choice colomn and there are three elements. I went to the Formula genterator and typed in the name of the column and the three choices and selected the color for each choice. is that right? then replaced the with and the closing tag as well

        Sorry I know u must be busy! 😦

  12. Pingback: Color coding: more examples « Path to SharePoint

  13. Pingback: HTML Calculated Column – Updated script « Path to SharePoint

  14. Pingback: HTML Calculated Column – Updated script v2.1 « Path to SharePoint

  15. I am trying to setup the same type of Calendar as Dave. I have a column with the type of events called calendar and two types of events. i also have a calutater column.
    I used the formula generator and here is the formula
    =” “&[Subject]&””
    I have added the HTML Calculated column wep part to the page just under the calendar but still can’t get the color to render.
    I guess I am missing something but I don’t know what.

  16. Apologies if this is caused by something else Christophe but at my wits end with this bizzare problem. I have an issues list in which I have included a html calculated column which displays the Issue ID with a colour coded background according to Issue Status.

    The code works fine until I edit an item in the list. When I return to the list from the edit screen the html still renders fine but does not show the ID after a refresh or even in a different browser window and/or different SP Page with the list on display. It has just gone for that entry alone, all unedited items display fine (which suggests its not the calculated column itself, but…)

    The only way I can get it to appear again is if I go into settings and open the calculated field and (without change) click okay. Bizzare!

    ="<DIV style='width:60%;text-align:center;"&IF(&#91;Exp days Period&#93;="","Pick a color",IF(&#91;Exp days Period&#93;="Overdue","background-color:Crimson;font-weight:bold;font-color:white",IF(&#91;Exp days Period&#93;="1-3 days","background-color:Red;font-weight:bold",IF(&#91;Exp days Period&#93;="4-6 days","background-color:Darkorange",IF(&#91;Exp days Period&#93;="1 week","PaleGreen",IF(&#91;Exp days Period&#93;="2 weeks","",IF(&#91;Exp days Period&#93;="3 weeks","",IF(&#91;Exp days Period&#93;="1 Month plus","",""))))))))&";'><a href='/git/spg/Lists/SharePoint Issues\dispform.aspx?ID="&ID&"' rel="nofollow">"&ID&"</a></DIV>"
    
     
    • To demonstrate I have just updated ID 23. This is teh html generated by the calculated column for ID’s 22-24. For some reason the ID is not generated, yet is for all unedited entries despite no conditional logic within the formula.

      It may be that this is not a problem with your script but a limitation with SharePoint formulas somehow that impacts on using your script. Of course it could be me being very stupid!

      22
      22

      23

      24
      24

      • Roy, this is a known SharePoint limitation, and it is mentioned in my post about the “HTML calculated column”. The ID field should not be used in formulas in calculated columns.

  17. Thanks Christoph, and sorry for my oversight. I now use an alternative field that gets set to the ID when the entry is created and that works fine.

  18. Hi Christophe,

    I’m trying to display infopath xml files (in a forms library) in a Sharepoint calendar view. Only problem is that the link opens the properties and not the xml file.
    I wanted to change the link to point directly to the xml file… I’ve tried using a calculated column to generate the link, but the text is not interpreted as HTML.
    The same calculated column in a “normal” view and your code works just fine…
    I would be very grateful if you had any ideas…

    Thanks very much

    • Sorry for the laste reply Alison. It’s hard to tell what is going wrong, but here is a clue: lists items are cells (td tags), so you can use any html element inside (div, span, etc.). Calendar items are hyperlinks (a tags), so you should only use inline elements (no div for example).
      For an example, see the difference between my post on lists (uses divs)and my post on calendars (uses spans).

  19. Christophe, I was so excited about applying this code to my content editor web part. We are operating in Sharepoint 2003, and although I have read other posts and they claim it works, I cannot the calendar to display. I’ve left all the defaults in the web part as is, but have had no success. I’ve used your abbreviated version for 2003:

    /* Tiny Calendar – SharePoint 2003 */
    /* Christophe@PathToSharePoint.com */
    .ms-calMid {height:0px;}
    .ms-CalSpacer {height:0px;}
    .ms-calhead {padding:0px;spacing:0px;}

    Do you have any other magic to work this brilliant idea of yours?

  20. I’ve been delightedly using the script to color lists for months. However, after a recent SP update by our administrators, the colors disappeared 😦

    I put the page in edit mode to see if the script got removed from the CEWP and the colors reappeared! When I exited edit mode, the colors remained — until I switch views, navigate away & come back, add/edit items, etc.

    Any insight into what’s happening? Does going in and out of edit mode render the page differently somehow (cache)?

    Thanks for any leads!

      • No, but I tried to after reading your question and I couldn’t discern any differences.

        To add to the wierdness, Firefox and IE demonstrate the symptoms mentioned above, but Chrome works as expected!

  21. Hey Christopher… loved the whole thing 🙂 absolutelly brilliant! only small issue I am having is with recurrent events in the same month… it is creating duplicated DIV IDs… any idea on how I can make them unique??
    Thinking of changing the javascript but would like to use something in the calculated formula!

    Tried using the Start Time and ID fields and no luck… it captures the first instance!

    Have a great day!
    Simone

  22. Hi Christopher,
    I’m trying to perform a simple test of the HTML calculated columns by creating a simple list with three columns: Title, Priority and Traffic light (calculated value) exactly the same as you explained in one of your exaples but i can only see the formula displayed as text . I’ve added the CEWP with the last published script but no luck. I’ve copy the text into an empty HTML file and it is working ok so the code generated by the calculated column is ok.
    Could it be that there is some kind of restriction made by the SP administrators?
    Thanks in advance for your help!
    Kind regards,

  23. Hi Christophe,

    Can u please take a look at my IF funtion is not working.

    =”IF(“&[Availability Status]&”=”&”Available”&”, “&”Yes”&”)”

    This will return just string,

    IF(Available=Available, Yes)

    Do you think this problem occurs from my Sharepoint Services 3.0 itself?

    I dont know why but it seems all the functions aren’t working.

    Regards,
    Fayadh

      • Fayadh
        Thanks Christophe for the quick response,

        I am afraid thats the main problem,

        this Sharepoint site could not read functions.

        if i put

        =IF(“&[Availability Status]&”=”&”Available”&”, “&”Yes”&”)

        it will return an error.

        “The formula contains a syntax error or is not supported.”

        do you have other solution? is it possible for me to use javascript in the listviewwebpart and grab the column [Availability Status] and use javascript on it?

        • After a long time finally I have found out the solution.
          The problem is because my sharepoint site is not using default language pack.

          Default language pack
          =IF([Availability Status]=”Available”, “Yes”, “No”)

          I replaced the ‘ , ‘ with ‘ ; ‘
          =IF([Availability Status]=”Available”; “Yes”; “No”)

          It works! Finally!

          Thanks for your time Christophe

          🙂

  24. Thanks Christophe for the quick response,

    I am afraid thats the main problem,

    this Sharepoint site could read functions.

    if i put

    =IF(“&[Availability Status]&”=”&”Available”&”, “&”Yes”&”)

    it will return an error.

    “The formula contains a syntax error or is not supported.”

    do you have other solution? is it possible for me to use javascript in the listviewwebpart and grab the column [Availability Status] and use javascript on it?

  25. I have followed the instruction to the letter and get no color in my calendar. I placed the webpart under the calendar and the DIV tag to SPAN and still no color is presented in the calendar. What have I missed.

  26. Nice!
    I’ve try this technique on a list that have a link type field, and I’ve put the image text on the “Description” field below it, assuming that the image will be clickable, but it not…

  27. Hi Christophe –

    I have applied this and it works almost perfectly. However, there are 2 entries that show the HTML instead of the color coded item. I initially figured that they were corrupt, so recreated them, copying them exacly, and now the recreated ones appear on the calendar that way. I’m beside myself trying to figure out why just these 2 (now 3) entries will not work but everything else will. I tried changing the Title and the dates and any other fields that I thought might affect the outcome, but it still doesn’t work. Any ideas?

    Thanks!

  28. Chris,

    First off want to THANK YOU for your site, really good stuff. I have used your HTML Calculated Column Script without any problems on several other pages/sites I have been working on. However, (don’t you just love when that work comes up) I have been trying to get this to work on an Article Style Page Layout but having a couple issues. 1) I have put a CEWP on the Page from Designer and tried to insert your script but the CEWP does not allow me the option for RichText or SourceCode to put in the script on the CEWP from the Task Pane. So, I applied it to the CEWP from the Code View of Designer but it does not work. 2) I put the script in a CEWP from the browser and then exported the working CEWP to my desktop and then imported it to the Page Layout through Designer but it still does not work. 3) If I open the “Article Page” in the browser and place the CEWP on the page and put the script in the CEWP, Apply, and Publish the Page it works just fine. However, I can’t have users applying a CEWP and placing the script into every Article Page they create. Any suggestions or tips on how to get this to work in an Article Page Layout? Thanks in advance for any direction you may give.

  29. I am having a problem similar to Helen’s, I think. (She posted 5 Feb.) I am using the SPAN code to put background colors on a calendar. (Three VIPs are represented in three different colors.) The script is in a hidden CEWP at the bottom of the page.

    The only calendar items that render in color, however, are those that are “all day” events, or those that span mulitple days. The events that are constrained to a time show up with HTML code instead of a background color.

    Any ideas how to fix this?

    teri 🙂

  30. I found somebody at work with calculated column experience, and he was able to solve my problem. It turns out I hadn’t tweaked my script properly. He made the right changes, so now all the color-coded calendar items are rendered *and* are clickable. 🙂

  31. =””

    I am using the above code to try to make the background color of the row based of the priority. It is just making the calculated column background color the right color but not the rest of the row! Please help!!!

  32. I get an error when trying to create a calculated column refering to a workflow status column in my document library. Is there a way to include a workflow status column in a formula?

    • Hmm.. that looks good to me.

      &lt;DIV&gt;&lt;img title='In Progress' border='0′ alt='Red' src='<a href="http://sharepoint.fmr.com/sites/SPS_Smart_Dev/Status%20Images/_t/red_PNG.jpg">http://sharepoint.fmr.com/sites/SPS_Smart_Dev/Status%20Images/_t/red_PNG.jpg</a> <br>‘&gt;&lt;/DIV&gt; 
  33. Hi Christophe,

    I have the calculated column (Colour) up and running and it generates the right colours, but by name only. When I add the following to the Content Editor

    =””&[Status ID]&””

    all I see in the Content Editor Window is this

    =”
    “&[Status ID]&”

    and there is no colour change on Status ID. Any ideas?

    Regards,
    Colin

  34. So I am attempting to use this web part to display a link in the description of a field… but it’s not working.

    Please certify that you have read and understand the CONFIDENTIALITY AND NON-DISCLOSURE POLICY section in the Associates Handbook. <DIV><A HREF='/hr/Shared%20Documents/Associate%20Handbook.pdf'>Associate Handbook</a><DIV>

    The view source looks like this:

    </table></span>Please certify that you have read and understand the CONFIDENTIALITY AND NON-DISCLOSURE POLICY section in the Associates Handbook. &lt;DIV&gt;&lt;A HREF='/hr/Shared%20Documents/Associate%20Handbook.pdf'&gt;Associate Handbook&lt;/a&gt;&lt;DIV&gt;</TD>
    • Stefanie, try this:

      <DIV>Please certify that you have read and understand the CONFIDENTIALITY AND NON-DISCLOSURE POLICY section in the <A HREF='/hr/Shared%20Documents/Associate%20Handbook.pdf'>Associate Handbook</a><DIV>

      Also, I’d recommend that you read more recent posts for code updates.

  35. Christophe, you rock!!! Thank you so much for posting these awesome tricks!

    I also got the CEWP script to work with a content type using an enhanced rich text column in a document library, which by default does not work. With your script placed after the doc library, the html code displayed like a charm!!!

    Looks like your hard work has helped lots of people here. I myself have saved so much time learning tricks from brilliant and willing people like you, so thanks again!!!

    Jen

  36. hi christophe
    i am trying to put the CEWP below the list webpart and added the last published script inthe CEWP. but i am unable to get the color o nthe list ………..

  37. Hi Christophe;

    Version 1.0 works in my SP 2003 env, but when I tried 2.1 I get the following returned in the CEWP when I am in Design mode on the page and the HTML is not rendered, it simply displays the HTML code as text.

    – Default Use for formatted text, tables, and images. true Right 2 Normal true true true true true true false Modeless
    Default
    Cannot import this Web Part. Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c Microsoft.SharePoint.WebPartPages.ContentEditorWebPart – – /* Text to HTML Lite – version 2.1.1 Questions and comments:Christophe@PathToSharePoint.com */ function TextToHTML(NodeSet, HTMLregexp) { var CellContent =””; var i=0; while (i< NodeSet.length){ try { CellContent = NodeSet[i].innerText || NodeSet[i].textContent; if (HTMLregexp.test(CellContent)) {NodeSet[i].innerHTML = CellContent;} } catch(err){} i=i+1; } } // Calendar views var regexpA = new RegExp("\\s*\\s*”); TextToHTML(document.getElementsByTagName(“a”),regexpA); // List views var regexpTD = new RegExp(“^\\s*\\s*$”); TextToHTML(document.getElementsByTagName(“TD”),regexpTD); ]]>

    I copied the code from the download site and pasted it into the source editor. Any ideas? My calculated field HTML is below:

    =CONCATENATE(“”,status,””)

    • Sorry, the code was released for SP 2007/2010, and I never tested it in SP 2003.
      In the download site, make sure you download the txt file and paste the content in your CEWP. I wouldn’t expect the web part file to be compatible with earlier versions.

  38. Hello Christophe,

    I keep getting the error message: “The formula contains a circular reference (the calculated column refers to itself). You must remove or change the circular reference.” This is the code that I have in my display column(No longer being used as per TW):

    =” “&[No longer being used as per TW]&””&[No longer being used as per TW]&””

    Please help

  39. Hello Christophe
    Thanks for a great work and even more thanks fore share and the helps around.
    I am having the html code instead of the bulls no matter which cewp I’m using.
    My code is as follow
    =”N”,”red”,IF([TV & Radio]=”R”,”gold”,”limegreen”))&”;’>•” language=’html’]

    My result looks like

  40. Hello Christophe
    Thanks for a great work and even more thanks fore share and the helps around.
    I am having the html code instead of the bulls no matter which cewp I’m using.
    My code is as follow
    =”N”,”red”,IF([TV & Radio]=”R”,”gold”,”limegreen”))&”;’>•” language=’html’]

    My result looks like

  41. Gunn :Hello ChristopheThanks for a great work and even more thanks fore share and the helps around.I am having the html code instead of the bulls no matter which cewp I’m using.My code is as follow=”N”,”red”,IF([TV & Radio]=”R”,”gold”,”limegreen”))&”;’>•” language=’html’]
    The result takes update the div with the color but does not show the bulls

  42. Thanks for the gift of all this work, Christophe.

    A rookie question, I’m sure: Does the calendar need to start as a calendar list type, or can it be applied to a calendar rendered from a custom list? If the latter is ‘yes’, then I may just have some t-shooting to do. I have successfully applied it to a list that began as a Calendar.

  43. Hi Christophe,

    Your code works like a treat!

    I have one question though (there is always a ‘but’!) how can I get it to work with a grouped list?

    When I add groupings to my list – the HTML unrenders.

    Cheers,

    L

        • I’m not sure if this works for you but we disciovered that by changing the Calculated column to field type of Number, we did not need the texttohtml.js on the view. However, we still need it in the Form.

  44. Hi Christophe,

    Tried reading through all the comments, so hope this haven’t been asked before. I am struggling with what is probably a syntax error, but I can’t for the life of me figure out what.

    I have a small simple list with one calculated field, “Aging”, using datediff and today trick to return number of months.

    I have added in a second calculated field for the use of HTML. What I am trying to achieve is when Aging is larger than 6, the text should be bold and red, and when it’s not it should be normal.

    The current code I am using is returning an error, but I am not sure what I have missed:

    =IF([Aging]>6;"<DIV style='font-weight:bold; color:red'>"[Aging]"</DIV>";[Aging])
      • I managed to solve the syntax error – and the text turn bold and red when [Aging] is higher than 6. However, it only prints out the word Aging, not the actual value. How can I ensure that the value of [Aging] column is printed correctly? I tried using “[Aging]”, but just creates a syntax error again.

        =IF(Aging>6;”Aging”;Aging)[/source]

    • Discard my last comment, I figured it out – thanks to your other post about calculated columns. I just had to escape using “&[Aging]&” 🙂

  45. Your posts on Calculated Columns worked great for SP 2010. Thank goodness for the Troubleshooting page as it told me where I’d gone wrong. You are a huge help – thank you a million times! lol!

  46. @Brad: right, I noticed that too but didn’t do extensive tests. Why it does that on the view and not in the form is beyond my understanding.

    A side effect is that your content is right aligned – this is actually because my user was asking for right aligned text that I used this trick in the first place.

    Maybe I should blog about it and see what others have found…

    Thanks for your comment!

    • Just to provide an update. It depends on what I’m trying to do with the HTML. If I’m trying to display a button, I merely had to change the column to Number and it would display fine in the list view without the use of texttohtml. However, if I’m trying to display the colored bullets as a status symbol, I still need the TextToHtml. I do know that the problems seem to be larger when you are grouping and collapsing the group. The pull down on the link to edit item column in the view stops working when you combine the texttohtml with grouping.

  47. Got a quick question.
    Trying to do this with a custom list. Followed the tutorial with a Choice Column (Priority) and another called (PriorityStatus).

    In PriorityStatus Column, I used the following formula:

    =”•”

    The option for Single Line of text is selected.

    My Priority Column is a choice with three options:
    (1) High
    (2) Normal
    (3) Low

    Drop-Down Menu
    Choice selected not Calculated value.

    This works fine with a “Issue Tracking” List. But, when creating a custom list, the filed that usually has the HTML in it before the Javascript, “PriorityStatus” doesn’t show the code, only #VALUE!

    Everything is the same, including the javascript placed below the list webpart.

    One thing to note, before adding the javascript on the “Issue Tracking” List, you do see the HTML code in the table like your examples. However in the custom”Issue Tracking” List, all you ever see if #VALUE! before and after adding the Javascript.

    Any Ideas? The Custom list is much a much better option in my case.

  48. Sorry, In PriorityStatus Column, I used the following formula:

    =”<DIV style=’font-weight:bold; font-size:24px; color:”&CHOOSE(RIGHT(LEFT(Priority,2),1),”red”,”orange”,”green”)&”;’>&bull;</DIV>”
    
  49. All,

    Can you think of a reason why this would not behave correctly in SP2010 when I have a view of a list that is leveraging the “Group By” feature?

    Using the old script in SP2007 everything worked correctly. I tried the old script (pre-2009) and it didn’t work, so I moved to the updated script for the content editor webpart, and it only sort of works.

    When I expand one of the groups, I get the HTML code instead of the color coded Status (High/Medium/Low), but for some reason when I expand the group above or below it, the first group gets the proper display even as the second group continues to display the HTML code.

    Did I miss something or it isn’t designed to work in SP2010?

  50. Hi,
    Thanks a lot for the article but for some reason I cant see the image. Here is the syntax of the calculated value: =”<img src='’ border=0>

    Still getting the X instead of image.
    Any thoughts?
    Thanks a lot

  51. I’m trying to use your excellent solution to pass a column value from a list view and/or DispForm as a querystring to another page using http://spff.codeplex.com on the destination EditForm.aspx page.
    So, my calculated column looks like this:
    [Code]=CONCATENATE(““)[/code]
    The formula generates clean-looking HTML before I place the CEWP with your (brilliant) code on the pages. Here’s the problem: once I drop your code on either page (DispForm or AllItems), the cell that should contain the URL from the formula is just blank. Nothing at all.
    I’ve tested the URL and formula syntax separately, and both work. Simple concatenation works on DispForm and AllItems, as well. All of the above work with both lite and full versions of HtmlToText. I’m stumped!

    PS, tabs in my install of IE9 freeze when I scroll up past the embedded WP video ad from the bottom of a long page. 😀

  52. =CONCATENATE("<span><a href='http://rocket/custservforms/test/Lists/TheOneForm/NewForm.aspx?Part%20Number=",[Part Number],"'></a></span>")
     
    • David, it seems that your hyperlink doesn’t include any text, which would of course explain why you don’t see anything. The last part of the concatenation should look like:
      ‘>Display text goes here</a></span>

  53. Hi Cristophe. First off, your guides have been wonderful for making pages of data much easier to read when color coded. Thank you for all your hard work.

    The issue we’re experiencing occurred after the upgrade to SP2010 (from 2007) and ONLY happens with a collapsed grouped list. It would seem to be the way it parses the data upon page load. Any collapsed groups aren’t parsed.

    Issue detail:
    When a group is expanded, we only see the html code. When the next group is expanded, it appears to run the script and then the 1st group expanded now shows the correct html code. Expand a 3rd column, and the 2nd shows correctly, but not the 3rd. Work your way down the list, and you can get all to show correctly, but it’s a pain with dozens of groups (it’s grouped by teams).

    While the work-around allows us to view most of the list properly, each person has to expand out the groups they are working on, and this must be done every time the page is loaded.

    Have you seen this behavior with SP2010 or would you know how we could force the script to parse the collapsed group data upon page load?

    • Nathan, these are old posts that applied to SP 2007 and will break in more recent versions (as you experienced). For SP 2010 you’ll need to take a look at more recent posts, published in 2010 and 2012.

      • Thanks for the quck reply Christophe.

        I was under the impression that the color-coded calendar showing ‘Yes’ for SP2010 meant it would still work in SP2010.

        http://usermanagedsolutions.com/SharePoint-User-Toolkit/default.aspx

        If it’s not compatible, I suppose we will need to use a different solution. I wanted to avoid rebuilding multiple lists and calendars on several team sites, but it looks like I have a lot of work to do.

        Thanks again.
        Nathan

    • Also, for my calendars to not have the default lime green color and to render the item colors properly, I added the style information from a different pathtosharepoint blog page.
      https://blog.pathtosharepoint.com/category/visualization/

      Put this in the top part of the previously mentioned script (before the line ”) and it will set background to none on calendar events.

      .ms-acal-selected, .ms-acal-item {
      background:none;border:0px;
      }

  54. Thanks for the troubleshooting page, I had pasted the code into a text window rather than the source editor. Also, since I was using a paged web part that only showed 3 items at a time, I had to play around with AJAX settings to get the paged list to refresh properly with colored bullets. It seems all AJAX options turned off is what works best, it works fine now.

    • Bob,

      Glad to hear it worked for you. Right, as soon as partial refreshes are involved, you need to get color coding in sync. I published in 2010 some basic code that re-runs the code at 200 ms intervals.

  55. Christophe: I successfully used your script in a CEWP in SP2007 at my last job. It worked great. But I’m trying to use it on a SP2010 site now, and it won’t render the HTML. It just prints it out as text, like the script is being ignored. It’s in a CEWP on the same page as the list.

    I’m just trying get anyML to render using a Formula:
    =””&Status&””

    Any suggestions?

Comments are closed.