Form - <TEXTAREA> - CSV file

Discussion in 'HTML' started by Michel Beaussart, Oct 26, 2005.

  1. Hi all,

    Not being a web developper, I will try to explain in few words the problem,
    I just encountered.
    A form contains a textarea elements, multilined. When processed the form is
    send to be saved into a csv file (using php) and the result is somewhat of a
    mess.
    Some lines would be perfect, while others would have a line break in the
    middle (two or three times..) making the process of the file impossible.
    I was wondering if there was a sort of conditioning possible to textarea to
    avoid this kind of behavior.
    Thank you for your help...
    !!
    Michel Beaussart, Oct 26, 2005
    #1
    1. Advertising

  2. Michel Beaussart wrote:

    > Hi all,
    >
    > Not being a web developper, I will try to explain in few words the problem,
    > I just encountered.
    > A form contains a textarea elements, multilined. When processed the form is
    > send to be saved into a csv file (using php) and the result is somewhat of a
    > mess.
    > Some lines would be perfect, while others would have a line break in the
    > middle (two or three times..) making the process of the file impossible.
    > I was wondering if there was a sort of conditioning possible to textarea to
    > avoid this kind of behavior.
    > Thank you for your help...
    > !!


    Depending on what you want to do with the resulting CSV, you may consider
    these things???...

    1. Place quotes ( "" ) around the data in the CSV column. Some CSV
    interpreters look for columns delimited by these.

    2. When you are creating you CSV file from the uploaded test in your
    textarea, your may do a serach-replace newlines for "special string" of
    some kind. This would only be effective if you are interpreting the CSV in
    either your own CSV view/reader, or your CSV gets published with special
    instructions on how to interpret newlines --> "special string"

    3. Instead of "NewLine" as the EndOfRecord flag, your may use something
    else such as "<NewLine>+<SpecialString>". Of course as above, you will need
    to instruct your interpreters to understand the next record flag.


    --
    a beef jerky web site : http://www.choicebeefjerky.com.au
    not a beef jerky web site : http://mycoolwheels.com/vote.cmks
    if the oil light is on, dont think it will just go away
    Disco Octopus, Oct 26, 2005
    #2
    1. Advertising

  3. > 3. Instead of "NewLine" as the EndOfRecord flag, your may use something
    > else such as "<NewLine>+<SpecialString>". Of course as above, you will need
    > to instruct your interpreters to understand the next record flag.


    Disco,
    I REALLY like the idea. It would help no matter what, to put delimiters for the records.
    Sounds like a great idea to me ..
    Yep..

    PLEASE HELP ME !!!!!!!!!!!!!!!!!
    I have no idea how to explain to this : <textarea cols='90' name='question2' rows='15'></textarea> that it could become 'this' + <somethingsomething>
    Should I just plug some javascript into it or is there some magic html tricks (not in my current edition of allmighty html)?
    Can I plug a "onblur" event on a textarea ?

    Thanks



    "Disco Octopus" <> wrote in message news:...
    > Michel Beaussart wrote:
    >
    > > Hi all,
    > >
    > > Not being a web developper, I will try to explain in few words the problem,
    > > I just encountered.
    > > A form contains a textarea elements, multilined. When processed the form is
    > > send to be saved into a csv file (using php) and the result is somewhat of a
    > > mess.
    > > Some lines would be perfect, while others would have a line break in the
    > > middle (two or three times..) making the process of the file impossible.
    > > I was wondering if there was a sort of conditioning possible to textarea to
    > > avoid this kind of behavior.
    > > Thank you for your help...
    > > !!

    >
    > Depending on what you want to do with the resulting CSV, you may consider
    > these things???...
    >
    > 1. Place quotes ( "" ) around the data in the CSV column. Some CSV
    > interpreters look for columns delimited by these.
    >
    > 2. When you are creating you CSV file from the uploaded test in your
    > textarea, your may do a serach-replace newlines for "special string" of
    > some kind. This would only be effective if you are interpreting the CSV in
    > either your own CSV view/reader, or your CSV gets published with special
    > instructions on how to interpret newlines --> "special string"
    >
    > 3. Instead of "NewLine" as the EndOfRecord flag, your may use something
    > else such as "<NewLine>+<SpecialString>". Of course as above, you will need
    > to instruct your interpreters to understand the next record flag.
    >
    >
    > --
    > a beef jerky web site : http://www.choicebeefjerky.com.au
    > not a beef jerky web site : http://mycoolwheels.com/vote.cmks
    > if the oil light is on, dont think it will just go away
    Michel Beaussart, Oct 26, 2005
    #3
  4. Michel Beaussart

    Mark Parnell Guest

    In our last episode, Michel Beaussart <>
    pronounced to alt.html:

    > Should I just plug some javascript into it


    You could do it in Javascript, but then it won't work (read: you'll
    still get the unformatted text) for those with Javascript
    disabled/unavailable.

    > or is there some magic html
    > tricks (not in my current edition of allmighty html)?


    No. HTML can't _do_ anything. It is just a lowly markup language.

    The only way to *reliably* do this would be in your form handler. Once
    the visitor submits the form, do your search and replace -
    <http://www.php.net/manual/en/function.str-replace.php> - on the value
    submitted from the textarea before generating the CSV file.

    BTW: Please don't post upside down.
    http://www.allmyfaqs.com/faq.pl?How_to_post
    http://en.wikipedia.org/wiki/Top-posting

    This will help:
    http://home.in.tum.de/~jain/software/oe-quotefix/

    It would also be appreciated if you could set your newsreader to wrap
    lines at a decent length. Around 76-78 characters is generally
    considered reasonable.

    --
    Mark Parnell
    http://clarkecomputers.com.au
    alt.html FAQ :: http://html-faq.com/
    Mark Parnell, Oct 26, 2005
    #4
  5. Michel Beaussart wrote:

    >> 3. Instead of "NewLine" as the EndOfRecord flag, your may use something
    >> else such as "<NewLine>+<SpecialString>". Of course as above, you will need
    >> to instruct your interpreters to understand the next record flag.

    >
    > Disco,
    > I REALLY like the idea. It would help no matter what, to put delimiters for the records.
    > Sounds like a great idea to me ..
    > Yep..
    >
    > PLEASE HELP ME !!!!!!!!!!!!!!!!!
    > I have no idea how to explain to this : <textarea cols='90' name='question2' rows='15'></textarea> that it could become 'this' + <somethingsomething>
    > Should I just plug some javascript into it or is there some magic html tricks (not in my current edition of allmighty html)?
    > Can I plug a "onblur" event on a textarea ?
    >
    > Thanks
    >


    I was thinking along the lines of a sever side thing.

    Once submitted to your server, the scripting langiuage (PHP, ASP, or
    whatever) would do all the work.

    There are many reasons not to use client side languages, but this
    particular job should not rely upon the client to do the work.


    --
    the beef jerky team : http://www.choicebeefjerky.com.au/distributors.html
    not a beef jerky web site : http://mycoolwheels.com/vote.cmks
    if you pay for your gym memebership, use it
    Disco Octopus, Oct 26, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?UTF-8?B?TWFydGluIFDDtnBwaW5n?=

    How to load a CSV/TXT file in a textarea?

    =?UTF-8?B?TWFydGluIFDDtnBwaW5n?=, Mar 25, 2006, in forum: HTML
    Replies:
    11
    Views:
    14,335
    Toby Inkster
    Mar 25, 2006
  2. Tintin92
    Replies:
    1
    Views:
    1,665
    Andrew Thompson
    Feb 14, 2007
  3. Augustus
    Replies:
    1
    Views:
    328
    Ken Schaefer
    Sep 10, 2003
  4. Textarea Inside of a textarea

    , Feb 4, 2006, in forum: ASP General
    Replies:
    6
    Views:
    306
    Anthony Jones
    Feb 5, 2006
  5. Replies:
    1
    Views:
    289
    Bart Van der Donck
    Jul 4, 2007
Loading...

Share This Page