...

View Full Version : Setting Max width of a text area



DR.Wong
12-14-2006, 10:17 AM
Hey everyone...

This is probably an easy to answer question, but I am at a loss here.

I have a text area on my site for people to submit comments, and well, it seems some people are entering LOOOONNNNGGG words. Now when they enter these long words, they mess up the alignment on my page when displayed from my database.

Is there a way to limit the amount of horizontal characters in a text area??

Thanks a lot!

nikkiH
12-14-2006, 02:15 PM
Using just html/css, no, I don't think so. Well, not without cutting off text, anyway. I assume you want a wrapping behavior.

Using any variety of scripting solutions, yes. You'd have to have some set character count and insert a space or other recognized word delimiter in there if one didn't exist.
It sounds like the problem is users entering characters in a row, all smushed up, right? No spaces or anything. So, you'd have to make a space either before the data is entered into the DB to begin with, or upon retrieval.

At least, as far as I know.

Excavator
12-14-2006, 03:50 PM
Hello nikkiH,
I don't know of any way of making CSS wrap either, but adding overflow: hidden to the CSS of your text area will at least stop it from breaking when someone puts a long word in it, till you figure out how to wrap it.

nikkiH
12-14-2006, 07:58 PM
Also, this might have a different answer if the element is a real textarea, like for a form, as opposed to like a div or span.
I think a textarea form element would wrap regardless, with no issues.

nolvorite
12-15-2006, 05:04 AM
<!--I am not sure of this, so just recheck.
<textarea onkeyup="checkmax(100000)">
</textarea>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum