![]() |
Form - <TEXTAREA> - CSV file
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... !! |
Re: Form - <TEXTAREA> - CSV file
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 |
Re: Form - <TEXTAREA> - CSV file
> 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" <discooctopus@yahoo.com> wrote in message news:mk9ddwtpdfgu.19d7c8mebxphb.dlg@40tude.net... > 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 |
Re: Form - <TEXTAREA> - CSV file
In our last episode, Michel Beaussart <mbeaussart@charter.net>
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/ |
Re: Form - <TEXTAREA> - CSV file
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 |
| All times are GMT. The time now is 05:51 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.