How do I create a multiline non-scrolling textbox?

It needs to behave like a textarea but with absolutely no scrolling behaivors.
LVL 5
mccainz2Asked:
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.

JeffHowdenCommented:
By "absolutely no scrolling behaviors" do you mean it shouldn't have a scrollbar?  Or, do you mean that when enough text is entered to fill the available space in the textarea that no more is allowed to be added?

If it's the former, some simple styling can accomplish what you want:

<textarea style="overflow: auto"></textarea>

However, as soon as sufficient text is entered to fill the box, scrollbars will appear.

If you meant the latter, that'll require an immensely more complex solution.
0
mccainz2Author Commented:
...unfortunately the immensely more complex solution.
0
JeffHowdenCommented:
Oh boy.  I was hoping you weren't going to say that as I'm not even sure if it's possible.   Perhaps if I understood the need for this better, I could suggest something that is doable.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mccainz2Author Commented:
I'm mimicing a standardized form that the user can fill out and print from the web. So, the fields for text entry are basically non scrolling boxes which correspond exactly to the sizes of the fields layed out on the old paper form.
0
mccainz2Author Commented:
Ive started looking at capturing keycodes within div tags that have been sized to the desired width and height, but the main problem I've run into with this approach is that the backspace button behaves badly (it causes the browser to go back to the last navigable page).
0
smaccariCommented:
Maybe this is a good starting point (IE only here though - but certainly not too hard to take a look for FF compliancy), using a textarea, the style attribute overflow Jeff spoke about, and simply by preventing default action (adding the key char in the textarea):

<script>
function checklength(obj)
{
      if (obj.value.length > parseInt(obj.cols)*parseInt(obj.rows)) event.returnValue = false;
}
</script>
<textarea style="overflow:hidden" rows=5 cols=20 onkeydown="checklength(this)"></textarea>

Need some tuning, but should work this way ;)
0

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
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
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.