13.03.2011 Updated the code to handle pasting into the field by adding “blur” eventhandler. Referred jQuery from Google.
14.03.2010 Updated to count down from limit to 0 and color code the counter. Also merged the “Count characters” and the “Count words” functions to one. See new code and explanation below.
I got this request from Larry:
new request for you. Character/word counter for multiple line field to display below the field. Not general for all multiple lines, but setup in a way that can set fieldinternalnames in am arr. also can we add a character limit, so user can not enterany more text.
I have several character counters. cant get it on the form. I am also looking into adding it on the create field page. calculated fields can only accept about 1000 characters. would like a way to display the count on that page.
I cannot help with the “create new column page”, as it is a server side file, shared between all site collections running on this server.
Add a CEWP below your NewForm and EditForm and add this code:
Get the code here
- FieldInternalName: FieldInternalName of the multi line plain text field.
- countWords: true to count words, false to count characters.
- limit: 0 for no limit and count up, a value bigger then 0 to set a limit and to count down.
- colorCodeCounter: true to add orange/red coding when limit is approaching.
- counterPrefix: The text to show before the counter.
Ask if anything is unclear