Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

carriage return is not correct in textareas (NN/Mozilla)

Status
Not open for further replies.

TekStepper

Programmer
Apr 29, 2004
7
DE
hello!

i havent found this topic in this or other forums yet. so i'll start it now....

our problem here is, that textares in netscapes/mozillas dont show the correct carriage return.
so if we set the cols-attribute to 60 for example, you can write up to 63 characters in 1 line!! first i think, that is because there is no scrollbar (until the text is so long, that a scrollbar appears).
but the main-problem with this is, that the browser makes a carriage return after the first word, when there are MORE THAN 128 CHARACTERS in the textarea!!!
so i think, that the browser gets 'confused' or something, cause you can write more characters in 1 line, as you defined in the cols-attribute.

pretty complicated case, but i hope there is someone out there, that could help us fixing this confusing thing!!

thanks a lot!
matthias
 
What is it you would like "fixed"? I don't really see that you have posted a question at all... rather a series of observations. What is it that you want?

if we set the cols-attribute to 60 for example, you can write up to 63 characters in 1 line

If you want to restrict the number of characters per line, then you will have to play with events and character counting.

I have never assumed that the cols attribute reflected the number of characters you can type in a column... I mean... the fact you can change the font/size in a textarea, how can this be enforced?!

If anything, I would imagine that early browsers took the route of "cols = the number of characters in a specific fixed pitch font and size (that we have determined without consulting anyone)".

I've probably missed the whole point of your thread. Please help me better understand your problem by providing a more structured and descriptive question.

Jeff
 
ok, so i try to explain it more properly...

like i said, the main-problem is, that the browser (Netscapes/Mozillas) makes a carriage return after the first word, when there are MORE THAN 128 CHARACTERS in the textarea!
and i thought, that the browser gets confused or so, when i can write more characters in 1 line, as i specified it in the cols-attribute.

so, first question is: do have these browsers problems with this cols/characters-thing?
but the main-question is: what can i do, that the browser doesnt make a carriage return after the first word, when there are more than 128 characters in the textarea?! ...could it be a problem with the charset?

help is much appreciated!
thanks a lot!
matthias
 
And wrap setting you use is... virtual/soft, physical/hard or off/none?
 
No problem with the character set that I can imagine. I think vongrunt might have hit the nail on the head with this though... look into using the "wrap" property of a textarea.

Also... are you just typing 128 characters without spaces between them? If I were to type a word, then a space, then 128 "x" characters (not seperated by spaces) then I would expect to see exactly what you described. Is this what you are doing?

Cheers,
Jeff
 
currently i use the 'soft'-setting. should i use something different? i tried already different settings though, but with no positive result.

no, its just a normal text, like the text im writing here.

thanks a lot!
matthias
 
This just doesn't sound right to me.

Could you post a URL for the offending page (or create another one and put it online) for us to look into. This will allow us to look at any other things in the page source that might be the cause.

I'm thinking maybe a doctype could be causing this.

Jeff
 
we use this doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

i create a copy of this page, and put it online. perhaps well find there something!

thanks a lot!
matthias
 
okidoki, here i have a very 'light' copy of the page:

for explanation: we push (with js) the content (the textarea) from a div (implemented in the iframe 'sourceiframe.html'), into a div in the index.html.
so, if you take a look in this page with netscape/mozilla/firefox/firebird (all in the newest version), then you will see, that there is a carriage return after the frist few words. and this carriage return is at a position, where there should no carriage return be.

thanks a lot!
matthias
 

Suggest you raise this as a bug with Mozilla team, if it's something that is causing your pages to break.

Hope this helps,
Dan
 
True... looks like bugzilla innerHTML "feature". Assign id="blah" to textarea and uncomment alert() line to check this. Next line (in bold) should fix the problem:
Code:
<SCRIPT language=javascript>
function init() 
{	document.getElementById('target').innerHTML = sourceiframe.document.getElementById('sourcediv').innerHTML;
	// alert( document.getElementById('blah').value );
	[b]document.getElementById('blah').value = sourceiframe.document.getElementById('blah').value;[/b]
}
</SCRIPT>
On the other hand... the same functionality doesn't require innerHTML at all.
 
but if i take the .value, i only have the value of the textarea, right?
i havent told that correctly, cause we want to 'push' a complete html-code (with tables and masses of other code) from one frame to another, incl. a textarea. and this, as far as i know, i cannot do with .value.

so, as i see this topic finally, it is a bug in mozilla?! ...seems to be worst case... :/

thanks a lot!
matthias
 
Bugzilla Bug 208869...

thank you very much for all your help!!!
matthias
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top