10

Running SP 2010 Enterprise and using SPD 2010. I have a yes/no column but want it to display as a checkbox in the list view as the list is being used as some sort of checklist. How can this be done?

  • What kind of web part you are using? – Amal Hashim Jun 1 '15 at 14:57
  • Just the default list WP – JazzyN Jun 1 '15 at 15:00
10

You can always add a calculated column to your list and show an image based if the column is "Yes" or "No" in the list view instead of having the column with the actual text value "Yes" and "No" displaying..

There are existing check box icons in SharePoint 2010 which might suit you.

cbChecked_locked.gif and cbUnChecked.gif

For an example you can use existing images ( or use any of your own ) in a calculated column based on the type number and add this:

=IF(YesNoColumnName=TRUE;"<img src='http://SharePointUrl/_layouts/images/cbChecked_locked.GIF' border='0'/>";"<img src='http://SharePointUrl/_layouts/images/cbUnChecked.GIF' border='0'/>")

This is the result based on what i used in the column "YesNoColumnName". ( Yes, i did it in 2013, but the images exist in 2010. )

enter image description here

Or you can create a calculated column and display any value based on the yes no column.

=IF(YesNoColumnName=TRUE,"This is the text when the column is Yes","This is the text when the column is No")

One additional note is that based on your regional setting in SharePoint, you might need to replace all ";" characters with a "," or vice versa.

  • Wanted to comment on this as it doesn't -really- answer the question, it's kind of like a weird work around and adds an odd extra step in an end-user work flow. What is the point of having an additional column you have to mess with just to display/show a checked box that is 'essentially' correlating it's checked status with the value of the box it's "calculating" from? This doesn't answer the question of, how to get a column type that is literally called "Yes/No (checkbox)" to actually SHOW as a checkbox instead of some weird Yes/No dropdown menu that's only a check box on new/edit list item. – Christopher Bruce Mar 24 '17 at 15:32
  • 1
    So, should i write a new answer two years later? If it would have been today, i would have used CSR in my answer. Feel free to downvote. – Christoffer Mar 24 '17 at 15:58
11

Just a minor variation on the given answer:

=IF(YesNoColumnName=TRUE
    ,
    "<img src='http://SharePointUrl/_layouts/images/cbChecked_locked.GIF' border='0'/>"
    ,
    "<img src='http://SharePointUrl/_layouts/images/cbUnChecked.GIF' border='0'/>"
   )

The less characters you type, the less mistakes you can make

The checkbox column is a boolean so you do not need to check for =TRUE
Unless you want to reference another SharePoint site you do no need the full URL
border=0 is the default so not required (and obsolete in HTML5)
If only for easy maintenance you can rewrite the Formula to:

="<img src='/_layouts/images/cb"
 & IF(YesNoColumnName,"Checked_locked","UnChecked")
 & ".GIF'/>"

Since the IMG tag is selfclosing and url references without spaces do not need quotes, you could even use:

="<img src=/_layouts/images/cb"
 & IF(YesNoColumnName,"Checked_locked","UnChecked")
 & ".GIF>"

And if the green checkmark instead of the locked/grey one is fine:

="<img src=/_layouts/images/cb"
 & IF(YesNoColumnName,"","un")
 & "checked.gif>"

Sorry.. too much time on my hands today :-)

Update: use Unicode characters instead of IMG

I actually dreamed on how to get that IF statement with the language dependant , or ; parameter separator out of there

If you use an HTML unicode character Ballot Box instead of the image it is the same Formula for every SP language environment

&#9744; =
and
&#9745; =

I added a DIV with some CSS for better formatting:

="<div style='font-size:25px;margin-top:-10px;color:darkgrey;'>"
&"&#974"
& 4 + YesNoColumnName
&";</div>"

Dirty programming, adding a boolean to an integer, but it works since false=0 and true=1

  • Great clarification, learned a lot more about calculations from this. :) – Christoffer Jun 2 '15 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.