SharePoint Word Count with Rich Text Editor

This could only be achieved via custom development and is not possible by using SharePoint’s out
of the box features or setup options  this following blog where a word count is achieved with JavaScript:

But there is also an exception , it is only working for a Input element.

Rich Text Box are different than normal text box

<TD vAlign=top width=190 noWrap>
<H3><NOBR>RichText</NOBR> </H3></TD>
<TD vAlign=top RteRedirect=”[Control Chain]_TextField_inplacerte”><!– FieldName=”RichText”
<DIV style=”DISPLAY: none” id=[Control Chain]_TextField_inplacerte_label>Rich text editor</DIV>
<DIV aria-haspopup=true style=”MIN-HEIGHT: 84px” id=[Control Chain]_TextField_inplacerte role=textbox aria-labelledby=[Control Chain]_TextField_inplacerte_label contentEditable=true InputFieldId=”[Control Chain]_TextField_spSave” UseInlineStyle=”True” aria-autocomplete=”both” aria-multiline=”true”>
<DIV style=”CLEAR: both”></DIV></DIV>
<SPAN dir=ltr><INPUT id= [Control Chain]_TextField_spSave name=[Control Chain]TextField_spSave type=hidden> </SPAN></SPAN></TD>

Text Area :
<TR><TD vAlign=top width=190 noWrap>
<H3><NOBR>RichText</NOBR> </H3></TD>
<TD vAlign=top><!– FieldName=”RichText”
<SPAN><TEXTAREA id=”[Control_Chain]_TextField title=RichText cols=20 rows=6 name=””></TEXTAREA>

SharePoint 2010 has using also div based RTE so javascript codes based on above artilce can be adjust like that;

<script src="<your jquery path and version>/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$('div[role*="textbox"]').bind('keyup blur',function(e){
 var thisLength = $(this).text().length;
if(true && thisLength>0){
thisLength = $(this).text().split(/[' '|\n]/).length;

if(true && 200>0){

}else if(thisLength>(200-10)){


currVal = $(this).text();
$(this).val(currVal.substring(0,currVal.lastIndexOf(' ')));
currVal = $(this).text();
thisLength = (200-thisLength<0)?0:200-thisLength;

$("#myCustomCounter_").html("Remaining words asda: "+thisLength);
}).parents('td:first').append("<span id='myCustomCounter_' style='padding:2;'></span>").find('input[name*="TextField_spSave"]');


MOSS2007 viewlsts.aspx reports that item count mismatch with document library item count.

This is very common misunderstanding of sharepoint libraries. Draft files can be counted as viewlsts.aspx reports. This meas documents count in document library can be different than actual count also item level security can provide this difference. But the real problem is even if System Admin or Site Administrator somehow can not able to see that documents in document library.

In our scenario we have 14 files that reported by viewlsts.aspx page , but when we login as system admin and browse the library the total file count which is same visible file count , is 13.And this problem is related with Sharepoint 2007 Sp1 which is currently not supported state. (So please upgrade your system as soon as possible to SP2) .So some of files should be check out to a user(s) . Ok than we checked the Document Library Settings->Manage Checked Out files and see nothing ? that’s wierd.

I am sure that the problem checkout to user so How could we find the users ? For troubleshooting issue we have to connect sharepoint db just for select. Don’t forget that  do not change anything in Sharepoint DB this kind of operations are not supported.

First We select all lists for finding Guid of the issued list.

select * from lists where  tp_Title  like ‘%Network Trainings%’
we noted the ListId Guid and SiteId guid from query results :

ListId: B08577CD-A418-4E08-8F6D-33365082FF05
SiteId: E39EF3B7-5679-45DE-8565-97D9C6F9CAB3

Than Getting all files for this list from AllDocs table:

select LeafName,DocLibRowId,[Type],Version,UIVersion,Dirty,IsCurrentVersion,[Level],DraftOwnerId from alldocs where listid=‘B08577CD-A418-4E08-8F6D-33365082FF05’

On results we compre the files for defining which file can not be able to seen by System Admin account:

“BGP  trainings.doc” ‘s DraftOwenerId is set to 960

The userid has changed by site collection so query userinfo table like this.

select * from userinfo where tp_SiteID=‘E39EF3B7-5679-45DE-8565-97D9C6F9CAB3’ and  tp_id=960
Resutls say : Domain****\a90003342 is draftowner

Now you can find the user account from results. we could not find the cause why the system admin account cant see the documents in “Manage Checked out files” also i don’t intend to find reason for unsupported version. We loged in with this user account and able to see all documents.So this is not a common scenario , i always suggest that use latest version of sharepoint sp and cu.