Textbox or Textarea limiting the number of lines and characters per line

I have a textbox that needs to be parsed into three lines of 60 characters max that will be stored in a database.  The user needs to have the format that they enter the data into the textbox remain consistent with how it will be stored in the database fields.  I can size the textbox so that it will wrap correctly at 60 characters but I don't know how to stop them after they enter the 60th character on the third line.

Thanks for any insight.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hi, this wraps the input at 60*3 chars, but is it what you're looking for ?
<textarea cols="60" rows="3" onkeyup="this.value = this.value.slice(0, 60*3);"></textarea>

nice Ben -- if you can add some JS to put in <CR>s at the end of each line (not here but generally speaking) you have a great thumbnail script.  However, the asker may want to force a CR at the end of 60 chars, I think that is what he is asking, not sure.
>>However, the asker may want to force a CR at the end of 60 chars, I think that is what he is asking, not sure.

If that's the desired result, it can be achieved during the db insert process ( something like textarea.value || char(10). IMO that doesn't really make sense as it would just be a redundant character stored in the db.

I think what you need to add to me code above is the css property :
word-wrap: break-word;

But unfortunately it's not implemented yet in all browsers, so you have to use hacks like this one :

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.