I´ve read that you can create a mini module to limit comments length. I´ts cool, and it´s working, but I need to add to it some JS so it tells you how many characters you have left.
So I´ve found some easy thing to do (via Google):
Put this inside your head tag:
<script language=”javascript”>
function limit(what,chars,counter) {
if (what.value.length > chars) {
what.value=what.value.substr(0,chars);
alert(‘You exceed to ‘ + chars + ‘chars!’);
}
counting = (chars – what.value.length);
c = document.getElementById(counter);
c.innerHTML = counting;
}
</script>
And put this in your body:
<label for=”text”><strong>Text</strong></label> ¦ Chars left: <span id=”count1″>500</span></p>
<textarea name=”[1][3][t]” rows=”10″ cols=”50″ onkeyup=”limit(this,500,’count1′);” onkeydown=”limit(this,500,’count1′);” onblur=”limit(this,500,’count1′);” onfocus=”limit(this,500,’count1′);”></textarea>
The thing is that I should add that inside the textarea of the comment body. As you can see, the code works, but how do I make it work the Drupal way?
I need only to limit comment length.
Thanks for your help! Rosamunda