2 replies [Last post]
KnightWolfJK
KnightWolfJK's picture
Offline
Enthusiast
Washington, DC
Last seen: 6 years 43 weeks ago
Washington, DC
Timezone: GMT-5
Joined: 2003-06-10
Posts: 210
Points: 0

I'm looking for a solution for my contact page. In the past I've used javascript to limit the amount of characters in a TEXTAREA box. Does anyone have better suggestions or strong reasons why I shouldn't be using Javascript for this?

It's all in the name of trying to learn the right way to do things... and man, what a pain in the *bleepity* *bleep* *bleep* sometimes :twisted:

Diplomacy is the art of letting someone have your way

Tags:
dJomp
dJomp's picture
Offline
Enthusiast
York, England
Last seen: 11 years 4 weeks ago
York, England
Joined: 2003-03-23
Posts: 422
Points: 0

Best way to limit TEXTAREA??

It's the only 'immediate' way I can think of.

The other way is to wait until it's posted and do it in PHP, but then the user hasn't a clue about how close to the limit they're getting. If you provide a little counter as well then javascript seems the best way to do it. I've seen similar on Web-TXT services, they can be useful.

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

insin
insin's picture
Offline
Enthusiast
Belfast, NI
Last seen: 10 years 50 weeks ago
Belfast, NI
Joined: 2003-05-07
Posts: 57
Points: 0

Best way to limit TEXTAREA??

No problem with using Javascript for that purpose, just make sure you also deal with trimming long messages on the server side as well for people who don't have javascript turned on. Smile

A Pedant Writes...
Into the mountain,
I will fall.