in reply to Newlines in textarea w/ CGI.pm

First it seems you're using HTML 4? (UPDATE:This explains a lot from jcwren in ChatterBox) So this might not work:

for <textarea> there is a Netscape 2 extension the wrap attribute.

Depending on who you consult the values may either be: OFF|HARD|SOFT or PHYSICAL|VIRTUAL; I've always used the latter.

--
perl -p -e "s/(?:\w);([st])/'\$1/mg"

Replies are listed 'Best First'.
Re: Re: Newlines in textarea w/ CGI.pm
by smitz (Chaplain) on Nov 18, 2001 at 23:18 UTC
    Ehhmmm... sorry, but that doesn't make work either! I tried all 5 options. Have a look at this. It takes the contents of the textarea and prints them. Youll notice that between each newline you use in the texarea, a space is printed. WTF?

      Err... I'm wondering about your assumptions now--when I view the source of the response page, I get the newlines back just as I submitted them. You are aware that HTML formats text with all whitespace treated equally, aren't you? That is, all runs of whitespace of any kind (\s+) are condensed to a single space (just as you describe, in fact). If you want to preserve the newlines, use <PRE>preformatted text</PRE> (in CGI.pm, that's pre($text)).

      If you are in fact aware of this, I apologize, but in that case I think you're looking at a browser issue--I'm getting back exactly the results I'd expect from your code, using IE5/Mac.



      If God had meant us to fly, he would *never* have given us the railroads.
          --Michael Flanders

      Try this, since you are using (based on jcwren's link, an IE3 specific syntax with <input type="textarea">

      <textarea wrap=physical></texarea>

      --
      perl -p -e "s/(?:\w);([st])/'\$1/mg"

        The HTML actually sends all the textboxes' newlines nicely, no matter what kind of wrap you are using.
        The problem is CGI.pm turns the %0A%0D into a single space, no matter how many newlines it encounters in a row. That my problem!

        SM|TZ