Form - <TEXTAREA> - CSV file

M

Michel Beaussart

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...
!!
 
D

Disco Octopus

Michel said:
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.
 
M

Michel Beaussart

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
 
M

Mark Parnell

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.
 
D

Disco Octopus

Michel said:
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.
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top