Hacker News new | ask | show | jobs
by cgallello 4219 days ago
Hm. Why don't they just limit the # of characters that can be typed in the title text box?
4 comments

I'm not them.

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.

Imagine if Twitter limited you to exactly 160 characters when you were composing tweets, instead of indicating you were over. It would be maddening.
Not everything that posts submissions to HN is a browser that will honour the maxlength attribute. For example, there are various mobile apps that scrape HN and allow you to submit urls.

Server side validation is entirely appropriate.

Server-side validation is always appropriate, but client-side validation is often (and certainly in this case) worth having as well.

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.

If I had to guess, so that the user can decide which parts to keep, based on the entire title. If they submit it via a bookmarklet, and the beginning of the title is "Some Corp Offical Blog | Mission Statement Blah Blah | Announcing The Worlds First" - you get nothing of value.