<pre> / paste-glue / textarea

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • spectre

    <pre> / paste-glue / textarea

    Hi,

    I need to copy/paste texts form word, notepad... to an html textarea
    to store it into a database.

    With the <pre>tag, and a text with long lines, the text displayed in
    the textarea needs to be scrolled horizontaly within the browser
    window: I can't succeed in stopping the text to be larger than the
    <table>;<tr>;<t d> settings.

    If I use the <p> tag, I don't have any of the line break I had in my
    original document and all the text is concateneted.

    Thanks to those who can help me to find a solution.

    Bi
  • Philip Ronan

    #2
    Re: &lt;pre&gt; / paste-glue / textarea

    On 28/9/04 1:54 pm, spectre wrote:
    [color=blue]
    > Hi,
    >
    > I need to copy/paste texts form word, notepad... to an html textarea
    > to store it into a database.
    >
    > With the <pre>tag, and a text with long lines, the text displayed in
    > the textarea needs to be scrolled horizontaly within the browser
    > window: I can't succeed in stopping the text to be larger than the
    > <table>;<tr>;<t d> settings.[/color]

    If you want horizontal scrolling in a text area, add wrap="off" to the
    TEXTAREA tag.

    --
    Philip Ronan
    phil.ronanzzz@v irgin.net
    (Please remove the "z"s if replying by email)


    Comment

    • Mark Tranchant

      #3
      Re: &lt;pre&gt; / paste-glue / textarea

      spectre wrote:
      [color=blue]
      > If I use the <p> tag, I don't have any of the line break I had in my
      > original document and all the text is concateneted.[/color]

      <p> with <br> in the appropriate places? I don't really understand your
      problem.

      --
      Mark.

      Comment

      • Bruce Lewis

        #4
        Re: &lt;pre&gt; / paste-glue / textarea

        propedeutique@y ahoo.fr (spectre) writes:
        [color=blue]
        > I need to copy/paste texts form word, notepad... to an html textarea
        > to store it into a database.[/color]

        My sympathies. I have to do the same thing.
        [color=blue]
        > With the <pre>tag, and a text with long lines, the text displayed in
        > the textarea needs to be scrolled horizontaly within the browser
        > window: I can't succeed in stopping the text to be larger than the
        > <table>;<tr>;<t d> settings.[/color]

        Use <tt> instead of <pre>, but escape newlines as <br>. I use
        (brl-newline-escaper "<br>\n") in my application. PHP has nl2br().
        You'll need to do something with server-side programming.

        Note that if they paste tables, the columns won't line up. More
        sophisticated text-to-html translation would be needed for that.

        Also note that you'll get a lot of nonstandard Microsoft characters, for
        quotes, etc. I use brl-msft-escape to fix it. You'll need to find
        something in your server-side language that does the same thing.
        There's a very complete Perl program called the demoronizer, if you're
        using Perl.

        Comment

        • Pierre Goiffon

          #5
          Re: &lt;pre&gt; / paste-glue / textarea

          "Bruce Lewis" <brlspam@yahoo. com> a écrit dans le message de
          news:nm94qliih5 c.fsf@mint-square.mit.edu[color=blue][color=green]
          >> I need to copy/paste texts form word, notepad... to an html textarea
          >> to store it into a database.[/color][/color]

          (...)[color=blue]
          > but escape newlines as <br>[/color]
          (...)

          If the idea is to save these texts in a database or anywhere else, for cms
          purposes, I don't think this would be a good advice to have HTML in your
          database records. You should keep datas media independant !

          Comment

          • Bruce Lewis

            #6
            Re: &lt;pre&gt; / paste-glue / textarea

            "Pierre Goiffon" <pgoiffon@nowhe re.invalid> writes:
            [color=blue]
            > If the idea is to save these texts in a database or anywhere else, for cms
            > purposes, I don't think this would be a good advice to have HTML in your
            > database records. You should keep datas media independant ![/color]

            No, the idea is not to save such text in a database. The escaping is
            only for display. You are absolutely correct.

            Comment

            Working...