473,757 Members | 8,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

textarea wrap

Hi

I have googled but not found a solution to wordwrap in a textarea using
firefox/netscape.

is there a style sheet solution or am i stuck with not being able to force
wrapping in a textarea

Mark

Mar 15 '06 #1
8 53021
VK

Mark D. Smith wrote:
Hi

I have googled but not found a solution to wordwrap in a textarea using
firefox/netscape.

is there a style sheet solution or am i stuck with not being able to force
wrapping in a textarea


Textarea has wrap attribute set to "logical" ("soft" by IE) by default,
so strings will be wrapped after reaching the opposite border, but only
manually typed Enter's will be submitted. So your task is to prevent
wrap, not to enable it ;-)

You can partially emulate wrap="off" by setting textarea style to:
white-space: nowrap;

But overall it is more standard and reliable to set "wrap" attribute:
"physical" - all visual line breaks are submitted as newlines
"logical" - you have visual line breaks but only "hardtyped" breaks are
submitted
"off" - rather clear I guess :-)

P.S. This attribute is missing in W3C DTD's by mistake (one didn't
understand the physical meaning of "wrap" and thought it to be
replaceable by styling). Nevertheless it is supported by all ever
existed browsers.

P.P.S. Modern browsers also support an alternate attribute set from
Microsoft: "soft", "hard", "off". These values have the same meaning
and effect, but the original Netscape set "logical", "physical" and
"off" has better cross-browser support, especially for legacy platforms.

Mar 15 '06 #2
VK wrote:
Textarea has wrap attribute set to "logical" ("soft" by IE) by default,
The textarea element has no wrap attribute according to the HTML
specifications. Browsers generally recognize such an attribute, but
information about "logical" as a value is outdated. The currently
recognized values are "soft", "hard", and "off".

There is of course no defined default for an attribute that is not
defined in the specifications. Most browsers actually behave as if
wrap="soft" had been given, but there is some variation in what this
means. This is not surprising, since there is no published specification
of what it means. Actually, the specifications more or less say that no
wrapping take place, since the idea is that the user can type
arbitrarily long lines. See
http://www.cs.tut.fi/~jkorpela/forms/textarea.html
for some explanations.
so strings will be wrapped after reaching the opposite border, but only
manually typed Enter's will be submitted.
More or less so, but there's a difference between IE and Firefox: if
there is a "word" (sequence of characters not containing whitespace
characters) that is longer than the textarea width, IE breaks the "word"
visually, whereas Firefox introduces horizontal scrolling. I don't think
there's a way to change the Firefox behavior (which corresponds to the
specifications better than the IE behavior).

To see what this means, test this on your browsers:

<textarea rows=3 cols=12>
supercalifragil isticexpialidoc ious
</textarea>
So your task is to prevent
wrap, not to enable it ;-)
Forcing either of them is impossible. The crucial question is why the OP
wants to force this or that behavior in this issue.
You can partially emulate wrap="off" by setting textarea style to:
white-space: nowrap;
Maybe it should do that, but it doesn't, even if you add overflow: auto
or overflow: scroll. That's at least the result of my testing on
Firefox. Please specify the URL of your test document and the version(s)
of Firefox you tested, if you have different _observations_.
But overall it is more standard and reliable to set "wrap" attribute:
"physical" - all visual line breaks are submitted as newlines
"logical" - you have visual line breaks but only "hardtyped" breaks are
submitted
"off" - rather clear I guess :-)
I don't think "physical" and "logical" have been supported for a long
time. At least Firefox 1.5 ignores them.
P.S. This attribute is missing in W3C DTD's by mistake
Please don't try to rewrite history. It was no mistake. Read the actual
specifications to learn how textarea was meant to work. Wrapping was
later invented by browser vendors and implemented inconsistently and
confusingly, as it still is.
Nevertheless it is supported by all ever
existed browsers.
Any statements about "all browsers" tend to tell about the limited
experience of the person who makes the statement rather than the reality
around us.
the original Netscape set "logical", "physical" and
"off" has better cross-browser support, especially for legacy platforms.


You didn't bother actually testing such matters, did you?
Mar 15 '06 #3
VK

Jukka K. Korpela wrote:
VK wrote:
Textarea has wrap attribute set to "logical" ("soft" by IE) by default,
That was my mistake: the set is "physical", *** virtual *** and "off".
I mistyped it because I must was thinking of total absence of logic in
this situation :-)
The textarea element has no wrap attribute according to the HTML
specifications. Browsers generally recognize such an attribute, but
information about "logical" as a value is outdated. The currently
recognized values are "soft", "hard", and "off".
Sorry again for "logical" instead of proper "virtual". HTML perfectly
has wrap attribute since Netscape 3 at least. It is not presented
though in W3C DTD's which is a serious problem of W3C but not of the
web community as such.
There is of course no defined default for an attribute that is not
defined in the specifications.
Of course you checked it, did you? For 90% of current UA's it is set to
"soft" by default, the rest is hiding the same setting from sensitive
eyes of W3C :-)
Most browsers actually behave as if
wrap="soft" had been given, but there is some variation in what this
means. This is not surprising, since there is no published specification
of what it means. Actually, the specifications more or less say that no
wrapping take place, since the idea is that the user can type
arbitrarily long lines. See
http://www.cs.tut.fi/~jkorpela/forms/textarea.html
for some explanations.
so strings will be wrapped after reaching the opposite border, but only
manually typed Enter's will be submitted.


More or less so, but there's a difference between IE and Firefox: if
there is a "word" (sequence of characters not containing whitespace
characters) that is longer than the textarea width, IE breaks the "word"
visually, whereas Firefox introduces horizontal scrolling. I don't think
there's a way to change the Firefox behavior (which corresponds to the
specifications better than the IE behavior).

To see what this means, test this on your browsers:

<textarea rows=3 cols=12>
supercalifragil isticexpialidoc ious
</textarea>


You are repeating the same mistake as 7 years ago - wrap attribute
doesn't set a *representation mode* - though it affects on it directly.
wrap attribute governes submission process of teaxtarea data. You
really should read old Netscape specs and consult with experienced
server admins. ;-) It is currently broken on some browsers in the
submission part, though the representation reflection is still working.
And I see W3C to blame for that because for 7 years no one reasonnable
browser producer could drop this attribute. So even the "standards
followers" had to implement it:- but in kind of conspiracy situation,
bootlegging it on the backyard.
P.S. This attribute is missing in W3C DTD's by mistake


Please don't try to rewrite history. It was no mistake. Read the actual
specifications to learn how textarea was meant to work. Wrapping was
later invented by browser vendors and implemented inconsistently and
confusingly, as it still is.


I was using wrap attribute since Netscape 3.0 Gold and never stopped to
do it - with necessary discrepancies adjustments over time. And no
offence but in the year 1999 W3C's activity was rather out of intensive
public interest. It was more important to know and remember all new
features and bugs in NN and IE. But coming back to "rewrite history":-
"I don't like it so it never existed and never will exist" - is an
exact case of trying to rewrite the history. And the lesson W3C may get
out of it is that no one can ignore the reality - but reality can
easily ignore anyone.
Nevertheless it is supported by all ever
existed browsers.


Any statements about "all browsers" tend to tell about the limited
experience of the person who makes the statement rather than the reality
around us.


Read about reality above.
the original Netscape set "logical", "physical" and
"off" has better cross-browser support, especially for legacy platforms.


You didn't bother actually testing such matters, did you?


I'm not testing - I'm using. W3C could facilitate the usage greatly by
finally sticking to one of de-facto standards and requiring the same
from all players (of whom willing to listen W3C).

Mar 15 '06 #4
VK wrote:
That was my mistake: the set is "physical", *** virtual *** and "off".
No it isn't. You are still in error.
Sorry again for "logical" instead of proper "virtual".
Stop saying you're sorry and check the facts. Neither of those values
has any support worth mentioning. Using wrap="virtual" seems to work for
the same reason as wrap="Hello world" does: it is ignored.
HTML perfectly
has wrap attribute since Netscape 3 at least.
Smells like trolling.
To see what this means, test this on your browsers:

<textarea rows=3 cols=12>
supercalifrag ilisticexpialid ocious
</textarea>


You are repeating the same mistake as 7 years ago


Do you mean that seven years ago you actually checked facts before
trying to give advice in public?
- wrap attribute
doesn't set a *representation mode*


Stop babbling and check the facts. What's so difficult in actually
looking at how browsers work?
the original Netscape set "logical", "physical" and
"off" has better cross-browser support, especially for legacy platforms.


You didn't bother actually testing such matters, did you?


I'm not testing - I'm using.


So when giving advice in future, will you be honest and precede your
advice with a statement that says that you describe what you have been
using, without actually checking the specifications _or_ actual browser
behavior in recent years?
Mar 15 '06 #5
VK
Jukka K. Korpela wrote:

<snip>
- wrap attribute
doesn't set a *representation mode*


Stop babbling and check the facts. What's so difficult in actually
looking at how browsers work?


With my pleasure. It is not clear though why it was necessary to wait 7
years until someone VK will make the job of the relevant W3C members(?)
My original statement first once again, OK?

"WRAP attribute in textarea is not a representation attribute despite
it has direct by secondary representation effect. This attribute
governes of how textarea data are treated and submitted".
A conclusion from this statement would be that it cannot be adequately
replaced by CSS representation rules - and never could, that is the
main reason it existed, existed and will ever exist.

Now the test (watch breaks, <textarea... strings should be on one line)
- let's go first by IE's model ("hard", "soft", "off"):

<html>
<head>
<title>WRAP test</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>
<body>
<form method="GET" action="">
<textarea name="ta01" cols="8" rows="4" wrap="OFF">Looo oooooong
line</textarea>
<textarea name="ta02" cols="8" rows="4" wrap="SOFT">Loo ooooooong
line</textarea>
<textarea name="ta03" cols="8" rows="4" wrap="HARD">Loo ooooooong
line</textarea>
<input type="submit" value="Submit">
</form>
</body>
</html>
the original Netscape set "logical", "physical" and
"off" has better cross-browser support, especially for legacy platforms.

You didn't bother actually testing such matters, did you?


I'm not testing - I'm using.


So when giving advice in future, will you be honest and precede your
advice with a statement that says that you describe what you have been
using, without actually checking the specifications _or_ actual browser
behavior in recent years?


Briefly and plainly (in continuation of my original request to W3C made
not a while ago): how soon we can expect HTML DTD's taken out of the
freezer (as they are "frozen" as one explained to me since 1999) and
brought back into usable condition?

I am not trolling: I am asking a very practical question from a person
who presumably may answer on it.

Mar 15 '06 #6
VK

VK wrote:
"WRAP attribute in textarea is not a representation attribute despite
it has direct by secondary representation effect.


"WRAP attribute in textarea is not a representation attribute despite
it has a direct but secondary representation effect.

Mar 15 '06 #7
VK wrote:
Now the test (watch breaks, <textarea... strings should be on one line)
- let's go first by IE's model ("hard", "soft", "off"):


Your way of saying that you were totally wrong in your advocation of
"physical" and "logical" is implicit but clear. Your attempt to
obfuscate this simple thing by pointless snippets of code, confused
attacks at the W3C, etc., makes it also rather clear that you have
decided to act destructively. Don't be surprised if you'll be ignored.
Mar 16 '06 #8
VK

Jukka K. Korpela wrote:
VK wrote:
Now the test (watch breaks, <textarea... strings should be on one line)
- let's go first by IE's model ("hard", "soft", "off"):
Your way of saying that you were totally wrong in your advocation of
"physical" and "logical" is implicit but clear.


I'm still not clear where did you get "logical" value. From my side it
was a typo instead of proper "virtual". And yes "hard/soft/off" have
better coverage taking into account the prevailing UA. By your
consideration it solves the problem of missing "wrap" in DTD anyhow?
Your attempt to
obfuscate this simple thing by pointless snippets of code, confused
attacks at the W3C, etc., makes it also rather clear that you have
decided to act destructively.
"pointless snippets of code"? Sorry, but did you actually try it? I
made it method="get" so one could see the submission dump in the
address bar. Did you look at new line escape sequences for off / soft /
hard?

But the main answer I guess is that HTML DTD's are frozen and will stay
frozen forever? Well, negative answer is still an answer. Let's wait
another year to come back to the same question.
Don't be surprised if you'll be ignored.


Don't be surprised if W3C DTD be (forcely) ignored.

Mar 16 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
32418
by: Sunil Kulkarni | last post by:
I need to validate my TextArea as follows: 1) IT SHOULD ALLOW FOR ONLY 5 COLUMNS 2) IT SHOULD ALLOW ONLY 65 CHARACTERS PER ROW I need some kind of a JS validation for the same. I have tried using hard wrap but that doesnt help completely. Any help in this matter would be very much appreciated! Thanks!
5
11228
by: chin | last post by:
Hi, I am trying to retrieved the value of the textarea with the newline preserved without having to submit the form to the server. Does anyone knows how to? I tried soft and hard wrap but both does not seems to affect the input in anyway. Example : <form name=frm> <textarea name=ta wrap="soft"></textarea> </form>
3
6773
by: Fluffy Convict | last post by:
I am trying to write a script that changes a textarea wrap realtime, basically like you can switch to and from "wordwrap" in Microsofts Notepad. Because of a bug (https://bugzilla.mozilla.org/show_bug.cgi?id=302710), FireFox does not listen to the textarea.wrap = 'soft' command. Because I want the script to be cross-browser compatible, someone suggested to remove and immediately add a node to the DOM, so I now have: ...
6
31449
by: Tony | last post by:
The w3schools HTML tag reference for <textarea> http://www.w3schools.com/tags/tag_textarea.asp says that the attributes 'cols' and 'rows' are REQUIRED attributes for the textarea tag. Looking at the HTML 4.01 specification I see this, too. What I'm wondering is - 'cols' & 'rows' determines the height & width of a textarea. So shouldn't that be something that is handled by CSS instead? What would be the practical consequence of leaving...
2
19286
by: mattrapoport | last post by:
Hello, I am have a div and inside of that div I have a textarea. There is nothing else in the div. The text in the textarea will come from a database so it needs to be able to wrap and grow as necessary. I've tried a whole bunch of permutations and I'm not having any luck. Any help would be greatly appreciated. Here's the code: HTML: <div class='desc'><textarea class='desc_text'>blah blah blah blah blah blah blah blah blah blah...
3
8185
by: zjw2112 | last post by:
Hello. I have some javascript code that dynamically creates a textarea and sets the wrap value to hard, which I thought would preserve CR/LF in the textarea: var otherTextArea = document.createElement("textarea"); otherTextArea.setAttribute("rows", "10"); otherTextArea.setAttribute("cols", "30"); otherTextArea.setAttribute("id", "otherTextArea"); otherTextArea.setAttribute("wrap", "hard");
20
2277
by: Tony B | last post by:
I'm learning a little about using forms in php to enter data, and have a couple of questions re textarea. At the moment I just use "addslashes() to process the value from textarea so that punctuation is escaped, and write this into a table. When the text wraps in the text box I get a new line in the value returned, as well as new lines that I enter manually. Is it possible to remove the wrap new line but keep the user entered new line ?
1
2443
by: RFleming | last post by:
I attempted to use the advice below, but still I keep getting word wrap in my inputtextarea. I am very new to XML and CSS, and I do not totally understand the layout. Below is the single XML line I am modifying: <h:inputTextarea binding="#{RaceReport.txtRiderInfo}" wordWrap="true" id="txtRiderInfo" style="border-width: 2px; border-style: solid; font- family: 'Courier New','Courier',monospace; font-size: 12px; height: 75%; left: 24px;...
8
2914
by: Floortje | last post by:
Hi, for the past few days now im trying to find some info on how to manipulate textarea's with javascript. Im trying to add content when a certain element is clicked or alter content if another is clicked (wrap ubb tags around it). I have found quite a few examples but they either dont work on all major browsers (example http://phphulp.jorendewit.nl/snippets/javascript/ubb.php) or they are complete WYSIWYG editors and have quite a large...
0
9906
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.