Package: collective.js.charcount
Table of ContentsOverviewAbout charCountPlugin Options (and default values)limit: 140warning: 25counterElement: ‘span’css: ‘counter’cssWarning: ‘warning’cssExceeded: ‘exceeded’counterText: ‘’How to installMostly HarmlessInstallationContributorsChangelogOverviewjQuery plugin Simplest Twitterlike dynamic character count for textareas and
input fields.About charCountThe first thing that this plugin do is create a sibling element (it adds is
immediately AFTER the form element), the “counter”, where the remaining
character info is stored. On each key up event or text field value change the
counting function is triggered and the contents of this “counter” element is
changed accordingly. If the remaining character count reaches the “warning”
zone (gets close to zero) the CSS class is added. We use this class to change
the color of the character count info. If the count reaches zero and goes beyond
it another class is added so we can use another style for exceeding the limit.Just so you can find your way around it, this is the code that the plugin generates
by default:<span class="counter">140</span>Plugin Options (and default values)limit: 140The character limit you wish to set for your text area or input field. It must be
a number.warning: 25When remaining characters reach the number set with this option the “warning” css
class name will be applied to the counter element.counterElement: ‘span’The type of element you wish to choose as your “counter” element. By default it is
a SPAN element, but you can use paragraphs, divs, strongs, ems…css: ‘counter’Class name added to the counter element. Use this class name as a css selector to
describe element’s appearance.cssWarning: ‘warning’Class name added to the counter element once the character count reaches the “warning”
number.cssExceeded: ‘exceeded’Class name added to the counter element once the character count reaches zero.counterText: ‘’If you wish to add some text before the remaining character number, you can do so by
using this option. It is empty by default.Here’s what default usage code looks like:$("#message1").charCount();…and this is the plugin usage with some customized options:$("#message2").charCount({
    allowed: 50,
    warning: 20,
    counterText: 'Characters left: '
});Also take a look at the CSS I used for my demos:form .counter{
    position:absolute;
    right:0;
    top:0;
    font-size:20px;
    font-weight:bold;
    color:#ccc;
}
form .warning{color:#600;}
form .exceeded{color:#e00;}How to installThis addon can be installed as any other Plone addon. Please follow officialdocumentation.After installing the package on your portal you can access the demo in:http://youportal.com/++resource++collective.js.charcount.demo.htmlHave an idea? Found a bug? Let us know byopening a support ticket.Mostly HarmlessInstallationWhen you’re reading this you have probably already runeasy_install collective.js.charcount. Find out how to install setuptools
(and EasyInstall) here:http://peak.telecommunity.com/DevCenter/EasyInstallGetpythonproductsand install it via:python setup.py install --home /path/to/instanceinto your Zope instance.Create a file calledcollective.js.charcount-configure.zcmlin the/path/to/instance/etc/package-includesdirectory.  The file
should only contain this:<include package="collective.js.charcount" />Alternatively, if you are using zc.buildout and the plone.recipe.zope2instance
recipe to manage your project, you can do this:Addcollective.js.charcountto the list of eggs to install, e.g.[buildout]
...
eggs = collective.js.charcountTell the plone.recipe.zope2instance recipe to install a ZCML slug:[instance]
recipe = plone.recipe.zope2instance
...
zcml = collective.js.charcountRe-run buildout, e.g. with:$ ./bin/buildoutYou can skip the ZCML slug if you are going to explicitly include the package
from another package’s configure.zcml file.After updating the configuration you need to run ‘’bin/buildout’’, which will
take care of updating your system.Go to the ‘Site Setup’ page in a Plone site and click on the ‘Add-ons’ link.Check the box next tocollective.js.charcountand click the ‘Activate’ button.Note: You may have to empty your browser cache and save your resource
registries in order to see the effects of the package installation.ContributorsCleber J. SantosChangelog1.0 (unreleased)Initial release