This is exactly what I was after, or exactly the kind of info I was trying to find out.
I guess I should have been a little clearer about what my purposes are, and why I'm 'cleaning up' the textarea in the first place.
Firstly, the cgi is intended to be a general purpose script to process surveys we do on our intranet. The cgi allows you to pass in some parameters to configure it (such as the delimiter to use in the output file, the name of the output file, etc.). The form data is 'encoded' and both written to an output file and sent in an email to the person administering the survey.
Now this 'encoding' or cleaning up is mainly meant for the textarea, where people tend to wax philosophic and ramble on for many lines. I need to be able to capture that in a flat file (typically pipe delimited, but I tried to make it so that it was flexible/extensible) and keep it in a format that is reasonably sane.
I don't want to lose the formatting, so that's kind of what I was originally trying to get at, "How do you deal with the data you get back from a textarea from a form?" Do you just write it out, or do you do anything to it to remove all the nefarious tabs, newlines, microsoft spew, weird browser cruft, etc?
By the way, I am using CGI.pm to bring all the form data, but CGI doesn't really give you anyway to 'clean' it once you've got it. That's what we got Perl for. :->
I'm starting to mess with CGI::Validate, but that doesn't seem to address this directly, really.
Anyway, thanks alot for the feedback so far.
This whole thing has also got me thinking why the textarea on this form is not wrap="virtual"... I hate when the textareas are not wrapped and the lines go on and on and on, but the people who made perlmonks are smart, they had to have done this for a reason...
In reply to Re: Tidying up textarea fields
by antjock
in thread Tidying up textarea fields
by antjock
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |