locked
Color Coding List Fields

    Question

  • I am trying to find a way to be able to have a list field color coded by what is selected in another field of the list.  If the Status field reflects Red, then the image filed should reflect the red circle image or the words in RED.  If the staus is green, then the image should be a green circle or the words GREENI can live with color coding if I can not have the actual image (red or yellow or green circle for status of list item).  I am unable to find a way to do this.  I have created a list with a picture field, but the user has to type in the url to the picture, which is not the greatest work around when the location is a long address.  We would rather not use Front Page either.  I have tried to use a calculated field, but unable to get the proper code in the code window to reflect the proper color or image.  Would need to be "if then" and not gotten it right yet.  I have tried the lookup field but will only return the hyperlink and not the actual image or color.  Need to figure out a way to work around.  Has anyone got any suggestions to help in creating a work around?

    Tuesday, October 23, 2007 10:24 PM

Answers

  • Sharepoint designer is the only way you would do that without development.

    Wednesday, October 24, 2007 2:52 AM
  • Hi,

     

    We were facing the same issue and what we did was stored the image in a picture library, created a picture/hyperlink field in the list and wrote an eventhandler that will populate the field based on the business logic. I know its kind of naive but easier than Designer I guess.

     

    Regards,

    Amish Trivedi

    Thursday, October 25, 2007 4:25 AM

All replies

  • Sharepoint designer is the only way you would do that without development.

    Wednesday, October 24, 2007 2:52 AM
  • Thank you for your reply and information.  Just want to confirm that SharePoint Designer is available in MOSS 2007 and not 2003?  Thanks again!

    Wednesday, October 24, 2007 1:40 PM
  • Sharepoint designer - is a seperate application you have to get from microsoft, and should be used with sharepoint 2007

    frontpage - is a seperate application you have to get from microsoft, and should be used with sharepoint 2003

    Wednesday, October 24, 2007 10:28 PM
  • Hi,

     

    We were facing the same issue and what we did was stored the image in a picture library, created a picture/hyperlink field in the list and wrote an eventhandler that will populate the field based on the business logic. I know its kind of naive but easier than Designer I guess.

     

    Regards,

    Amish Trivedi

    Thursday, October 25, 2007 4:25 AM
  • If using visual studio 2005 is not a problem I think that using a custom field type will let you create such a behaviour... like exposing itself as a image during Display mode but saving a text value (like an status or so).

    This way, during edit the control will be redered as either a textbox or a dropdown... letting the user select the desired value... but when rendered in Display mode (as in the AllItems.aspx page) it will render as an image.

    A few days ago I posted here with a sample ImageLink custom field type (just search this forum) I think you can use this code as a basis for a control like the one you need.

     

    You  need to customize the RenderPattern for DisplayMode of the control. While testing for particula values of the column, instead of outputting the value of the column, simply render a IMG HTML tag for each value

     

    Saturday, October 27, 2007 9:39 PM
  •  

    Is there a way to do this which doesn't require any Sharepoint server changes or Sharepoint Designer?    My company will not let anyone make changes to Sharepoint servers, they are emmeshed in mountains of bureaucracy.

     

    I was able to get the visual result that we need through S.Designer, but after that update all changes to the list had to be made in S Designer.     We don't want that!!!

     

    All we are after is a simple project task list with a traffic light image based upon user selection of status: " On track" means green traffic light, etc.

    Thursday, March 27, 2008 4:35 PM
  •  

    Hi Amish,

     

    How and where do you install the even handler?

     

    Can I see a sample?    This sounds like what we need.

     

    Thanks, Maureen

    Thursday, March 27, 2008 4:48 PM
  • Hi Maureen,

     

    Event handler dll has to be installed in GAC or Bin folder of the SharePoint Web Front End server. And Eventhandler can be installed using features or a dummy console project. There is code available for doing both on the internet.

     

    Hope this is helpful.

     

    Thanks,

    Amish Trivedi

     

    Thursday, March 27, 2008 6:16 PM
  • Hello,

    I have just published a post that answers your question - no SharePoint Designer or server side action required. Here is the link:
    http://pathtosharepoint.wordpress.com/2008/09/01/apply-color-coding-to-your-sharepoint-lists/

    My examples may be slightly different from your needs, feel free to leave a comment on the site or use the contact information if you need more explanations.

    Hope this helps,

    Christophe
    Monday, September 01, 2008 8:05 AM
  • I know this is a really old post, but for anyone else reading this like I am, this warrant's a HUGE correction.  You can do this several different ways without any development or having to use SharePoint Designer.

    I have been creating calculated fields using IF statements just as the one below for YEARS now...before this post.  It is very simple and nothing new.  Read Christopher's post below, he is doing it the same way I have, however, in reading it his JavaScript that goes in the Content Editor Web Part is MUCH cleaner than mine.

    Here is a sample calculated field for anyone new reading this old post:

    =IF([Task Status]="On Hold","<DIV><IMG src='/_layouts/images/red.png' /></DIV>",IF([Task Status]="Delayed","<DIV><IMG src='/_layouts/images/Orange.png' /></DIV>",IF([Task Status]="Not Started","<DIV><IMG src='/_layouts/images/Yellow.png' /></DIV>",IF([Task Status]="Started","<DIV><IMG src='/_layouts/images/Green.png' /></DIV>",IF([Task Status]="In Progress","<DIV><IMG src='/_layouts/images/Blue.png' /></DIV>","<DIV><IMG src='/_layouts/images/Brown.png' /></DIV>")))))

    Then follow Christopher's steps for the CEWP JavaScript.
    Linda Chapman | SharePoint Consultant | My Blog: http://LindaLeeChapman.Spaces.Live.com
    Thursday, January 21, 2010 12:35 AM