Adding a Name Field to Comments on a WSS Blog

The other morning I got a comment on one of my posts that said:

"Oh, another one of these Sharepoint Blogs with no input field for a name – strange concept this is."

When I read this I thought to myself, "my, that is peculiar!"

And then I thought, "bah! I’ll just add the column to the comments list!"

This turned out to be a little trickier than I was expecting so I thought I might share how it was done in case anyone else is bothered by this….

First, navigate to the comments list

and create a new column.

I chose to name mine "Your name" and configure it as follows:

Feeling smug and very good about myself and my WSS prowess I decided to test the results.

Well, well. It seems the SharePoint gods hate the overly proud. Chastened and humbled I decide to have a look at the Posts.aspx form under the Posts list in SharePoint Designer. I wanted to look at the ListViewWebPart in an easy to consume fashion so I right clicked it and chose Convert to XSLT Data View.

I’m not sure if the blame lies with designer or the list template, but the result was not pleasing.

Now, at this point I could have tried fixing up the XSLT, but the output resulting from the conversion operation was good enough for me to see that I needed to replace the "Author" field with my new field which is called "Your_x0020_name". So, I closed the form without saving it, because you can’t just CTRL-Z undo the conversion, and reopened it. In the ListViewXML element of the Comments web part I located the applicable portion shown below:

Field Name="Author"/><HTML><![CDATA[ at <span dir="ltr">]]></HTML><Field Name="Created"/><HTML><![CDATA[</span></div>]]></HTML></ViewBody><ViewFooter><IfHasRights><RightsChoices><RightsGroup PermAddListItems="required"/></RightsChoices><Then><HTML><![CDATA[</div> <h3 class="ms-CommentHeader">Add Comment</h3>]]></HTML></Then><Else><HTML><![CDATA[</div>]]></HTML></Else></IfHasRights></ViewFooter><ViewFields><FieldRef Name="Title"/><FieldRef Name="Body"/><FieldRef Name="PostTitle"/><FieldRef Name="Author"

and edited it to use my new field instead of Author:

Field Name="Your_x0020_name"/><HTML><![CDATA[ at <span dir="ltr">]]></HTML><Field Name="Created"/><HTML><![CDATA[</span></div>]]></HTML></ViewBody><ViewFooter><IfHasRights><RightsChoices><RightsGroup PermAddListItems="required"/></RightsChoices><Then><HTML><![CDATA[</div> <h3 class="ms-CommentHeader">Add Comment</h3>]]></HTML></Then><Else><HTML><![CDATA[</div>]]></HTML></Else></IfHasRights></ViewFooter><ViewFields><FieldRef Name="Title"/><FieldRef Name="Body"/><FieldRef Name="PostTitle"/><FieldRef Name="Your_x0020_name"

After saving my work I returned to the page that had so rudely mocked my vain pride earlier and hit refresh.

Viola!

–Doug Ware

Author: Doug Ware