Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Form - <TEXTAREA> - CSV file

Reply
Thread Tools

Form - <TEXTAREA> - CSV file

 
 
Michel Beaussart
Guest
Posts: n/a
 
      10-25-2005
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...
!!


 
Reply With Quote
 
 
 
 
Disco Octopus
Guest
Posts: n/a
 
      10-26-2005
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
 
Reply With Quote
 
 
 
 
Michel Beaussart
Guest
Posts: n/a
 
      10-26-2005
> 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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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

 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      10-26-2005
In our last episode, Michel Beaussart <(E-Mail Removed)>
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/
 
Reply With Quote
 
Disco Octopus
Guest
Posts: n/a
 
      10-26-2005
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
read CSV file using csv library Li Chen Ruby 18 03-23-2010 12:44 AM
read and write csv file using csv module jliu66 Python 0 10-19-2007 03:12 PM
How to move data from a CSV file to a JTable, and from a JTable to a CSV file ? Tintin92 Java 1 02-14-2007 06:51 PM
Re: csv writerow creates double spaced excel csv files Skip Montanaro Python 0 02-13-2004 08:50 PM
csv writerow creates double spaced excel csv files Michal Mikolajczyk Python 0 02-13-2004 08:38 PM



Advertisments