[thelist] Limiting length of textarea field

Anthony Baratta anthony at baratta.com
Thu Jan 4 15:27:35 CST 2007

Here's a better option...

How are you allowing a printable option? If you offer a print button, you can use a "print media" CSS file "hide" the textarea, and replace it with a DIV, and copy the text in the textarea to the now visable div via JS. 

This way you can get all the text visible with the print out - but postable to the web server.

Hope that makes sense.

-----Original message-----
From: "FayeC" ftarzwell at fayec.com
Date: Thu, 04 Jan 2007 12:54:03 -0800
To: thelist at lists.evolt.org
Subject: [thelist] Limiting length of textarea field

> 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