[thelist] Limiting length of textarea field

ben morrison morrison.ben at gmail.com
Fri Jan 5 04:01:06 CST 2007


On 1/4/07, FayeC <ftarzwell at fayec.com> wrote:
> 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?

Could you show us an example? My first thoughts would be to change the
style of the textarea in the print CSS.

	<style type="text/css" media="print">
		textarea {
			overflow:visible;
		}
	</style>

ben
-- 
Ben Morrison



More information about the thelist mailing list