I've been trying to add such a counter, but without success. That is hardly surprising, given my very limited skills..
One of the scripts I tried was very small:
<<Insert into head>>:
<!-- Begin
function checkchars(form) {
var max=15;
if (form.chars.value.length > max) {
alert("Please do not enter more than 15 characters. Please shorten your entry and submit again.");
return false;
}
else return true;
}
// End -->
</script><<Insert into Body>>:
<center>
<form onsubmit="return checkchars(this)">
Please type 15 characters or less.
<textarea rows=5 cols=30 name=chars wrap=virtual></textarea>
<input type=submit value="Submit!">
</form>
</center>
I found that on this jsmadeeasy site But there are many more of such scripts to be found.
Pritlog already has a character counter for comments, but it is only activated after the "Add Comment" button is clicked. Not very user-friendly, especially because the comment gets deleted if it has more than the max allowed characters.(default : 500)
After my unsuccessful fiddling with this, I thought it could be even easier and more in line with Prit's YAGNI philosophy :) Why not just have a static text box for comments, without a counter. A user can write a comment, until the box is full...