<script type="text/javascript">document.getElementById('title').onkeyup = function(){document.getElementById('warning').innerHTML = this.value.length > 80 ? this.value.length + ' / 80 maximum characters' : '';return true;};</script>
Requires setting an "id" attribute on the title input field and then adding another element underneath of it with a "warning" id (<br><span id="warning"></span> works nicely).I'm replying to a comment before about Helperifix. As far as i know, the project is on hold. I know the guys, this is my email if you want to find out more info: lukejamesfitzpatrick@gmail.com
But maybe because when you paste a value longer than the max it just chops off the end. That sounds good until you consider that the ultimate goal is to have people re-structure their titles to fit the constraints as best they can rather than just providing a "preview" of the content (e.g. first line of the content).
For example I may paste in:
> LambdaLite: A functional, relational Lisp database written in 250 lines of Common Lisp
That's 87 characters. It would get mangled to this:
> LambdaLite: A functional, relational Lisp database written in 250 lines of Comm
So now the person entering the title has to paste it into notepad, fix it, and then paste it into HK within the length requirements. That doesn't help anyone.
Instead just accept an infinite length, and provide feedback on it allowing people to alter the title to perfection until the error goes away, no mangling or deleting title contents.
Server side validation is entirely appropriate.
I think limiting the number of characters is a good solution when Javascript isn't available, but warning the user that their input is too long is a more friendly solution where possible.
It chops off the end of pasted/bookmarklet titles.
For an example, Twitter's entry box on their web app gives a character count in the bottom right but still lets you go over, but anything over 140 characters is given a background color of red. It's very clear to a user what the problem is.