Textarea and beginning linefeeds...

D

Daniel Bleisteiner

Hi everybody.

It's for quite some time now that I'm aware of a problem with linefeeds at
the beginning of a textarea. But I could never find a solution for that.
Maybe you can help me at last.

Whenever I have a <textarea></textarea> in any form with some text which
starts with several linefeeds the first of those linefeeds is not shown in
the textarea in the browser. I know that this comes from the definition as
a whitespace in html. The problem is most anyoing in dynamic
webapplications where the same text is submitted over an over again and
with every submit one linefeed gets deleted.

You can test this yourself (to be sure what I mean) by translating a text
with some linefeeds at the beginning at
http://babelfish.altavista.com/babelfish/tr - just retranslate the text
several times on the following response page. You will see what I mean.

Is there any flag for the <textarea> or any other workaround which solves
this problem?
 
B

brucie

It's for quite some time now that I'm aware of a problem with linefeeds at
the beginning of a textarea. But I could never find a solution for that.

if you don't want them use your server side script to strip them. if you
do want them use your server side script to stick them in.

your normal form validation should cover things like that.
 
D

Daniel Bleisteiner

if you don't want them use your server side script to strip them. if you
do want them use your server side script to stick them in.

your normal form validation should cover things like that.

I'm not able to. We use WebObjects here which generates the tag on its own
and I can't change this in an easy way. That's why I have hoped for any
other solution.
 
B

brucie

I'm not able to. We use WebObjects here which generates the tag on its own
and I can't change this in an easy way. That's why I have hoped for any
other solution.

you're screwed. find out who controls webobjects and offer cash and/or
sexual favors if they fix it.

although i didn't visit any of the links to see if they were applicable
to your problem (you haven't offered any sexual favors) a quick google
seems to show its a known problem.

http://www.google.com/search?q=webobjects+linefeed&num=50
 
D

Daniel Bleisteiner

you're screwed. find out who controls webobjects and offer cash and/or
sexual favors if they fix it.
*grin*

although i didn't visit any of the links to see if they were applicable
to your problem (you haven't offered any sexual favors) a quick google
seems to show its a known problem.

Yes, I've searched for a solution before but could not find some... :(
 
O

Owen Jacobson

if you do want them use your server side script to stick them in.

I think this is a big hint for working around the bug in webobjects. It's
hackish and failure-prone (off the top of my head it seems that this
wouldn't catch only *one* missing newline) but if you check to see if the
text begins with a newline you can stick an extra newline into the text
before having the software generate the HTML, can't you?
 
B

brucie

I think this is a big hint for working around the bug in webobjects. It's
hackish and failure-prone (off the top of my head it seems that this
wouldn't catch only *one* missing newline) but if you check to see if the
text begins with a newline you can stick an extra newline into the text
before having the software generate the HTML, can't you?

if it cant do something simple like that i would be looking for a better
product, it wouldn't be hard to find one.
 
D

Daniel Bleisteiner

I think this is a big hint for working around the bug in webobjects.
It's
hackish and failure-prone (off the top of my head it seems that this
wouldn't catch only *one* missing newline) but if you check to see if the
text begins with a newline you can stick an extra newline into the text
before having the software generate the HTML, can't you?

It's not that easy... WebObjects automatically reads and writes to the
variable without any work from me. So I would have to stuff the variable
itself before generation and shorten it right after this. This is
possible.. but very tricky.
 
D

Daniel Bleisteiner

if it cant do something simple like that i would be looking for a better
product, it wouldn't be hard to find one.

Believe me, WebObjects is one of the best. I had the chance to check many
other techniques in the past 4 weeks (Struts, Tapestry, JSP, Servlets...)
and it was a pain. WebObjects allows you to do things most other existing
webserver technologies won't allow or make it nearly impossible to do. On
the other hand - and that is my problem right now - WebObjects makes that
much work that it's sometimes hard to change some simple things. I could
write my own WOTextArea (thats the object) replacement - but this is a
complex task.

I'll see what I find else...
 
B

brucie

Believe me, WebObjects is one of the best.

but its not the best one for you if it doesn't do what you want/need or
screws you around with trivial (except for webobjects) issues.
On the other hand - and that is my problem right now - WebObjects
makes that much work that it's sometimes hard to change some simple
things.

what has apple support said?
 
D

Daniel Bleisteiner

but its not the best one for you if it doesn't do what you want/need or
screws you around with trivial (except for webobjects) issues.

There is no better :-|
what has apple support said?

Hehe... Apple doesn't care much about their "small" customers. There is a
solution... but as I said - no easy one.
 
O

Owen Jacobson

There is no better :-|

Tell you what, why don't you actually tell us what you're trying to do
rather than the problem you're running into with one specific solution?
 
D

Daniel Bleisteiner

Tell you what, why don't you actually tell us what you're trying to do
rather than the problem you're running into with one specific solution?

Hehe... because I have a solution which has been developed over 3 years
now and works quite well. I don't want to discuss this because it doesn't
matter to my problem. I won't switch my environment because of this small
anoyance.

The problem is what I have told and if there is no other solution than to
stuff the HTML with an additional "\n" then there is no other. That's what
I wanted to know about. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top