Limit number of characters after a limited number of carriage returns

Complete

New Member
I have a query about a multi line textarea. I have a comments box for a report created using Crystal Reports and I want to limit the number of characters which is easy using the html maxsize. But then the users can just hit return a lot of times which causes the text to go out the box area on the report.I found some Javascript to limit the number of carriage returns and this works. But if carriage return 3 times having a limit of 3 carriage returns then on the 3rd line you could type your max limit of characters from then on which would still then cause the text to go out the printable area.How can I limit the carriage returns followed by limiting the number of characters on that last line. So if they hit return 3 times on that 3rd line they are limited to a number of characters so the area is not broken. So effectively keeping the text into a set area? The javascript for the carriage returns limit is below.\[code\] var keynum, lines = 1; function limitLines(obj, e) { // IE if (window.event) { keynum = e.keyCode; // Netscape/Firefox/Opera } else if (e.which) { keynum = e.which; } if (keynum == 13) { if (lines == obj.rows) { return false; } else { lines++; } } }\[/code\]
 
Back
Top