[thelist] Limiting length of textarea field

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Thu Jan 4 15:18:33 CST 2007



   You might try wrap="hard", but I'm not sure how universal that behavior is.

   If you want to divide the text, you can do so in client script or on the server (or both); you'd need a loop that runs through the text and adds a hard return after every n characters (assuming one isn't already present).

Peter

				From: "FayeC" ftarzwell at fayec.com

I was given a request to limit the textarea's length to the size of
the visible area of a textarea. This is to allow the printed copy to
have the same content as the form sent by email.
So I found a javascript that limits the number of characters of a textarea.
It works fine but since it doesn't consider a line break a character
people can still enter lines and lines of text beyond the visible area
of the textarea as long as there are still characters to be used.

I have a 7 row, 68 column textarea and I limited the characters to
475. It works fine if you type a straight line of 475 characters but
if you break the line after a few words on each line you can go way
beyond the visible area which means that even though the email will be
sent with the correct content, the printed copy won't.
Doesn't anybody know a way to limit the content to the amopunt of lines as well?

Thanks,

FayeC



More information about the thelist mailing list