Link to home
Start Free TrialLog in
Avatar of llakow
llakow

asked on

Textarea input truncates paste from notepad after 1st carriage return in IE

I have a textarea input field on a form where users can either type content manually or paste in lists from notepad or columns or rows in a spreadsheet.  In Firefox, it works perfectly, in IE7 and 8 the pasted information is truncated after the first carriage return if the source is columnar - it works properly if it is all on one line or in one row.

An example would be as follows.

If you copy the content of a Notepad file
Line1
Line2
Line3
...
and paste it into the filed in Firefox, you get
Line1 Line2 Line3 ....     which then processes properly

If you paste the same content into IE, your get
Line1

and nothing more.

I need to find a way to accommodate columnar content from Notepad and spreadsheets in both environments (and Safari as well, although i haven't tested it there yet) since users will be deriving lists from a variety of sources and using notepad or a spreadsheet as a pre-processor to get the list items into the textarea.
The only Javascript on the page checks that the field isn't empty onsubmit.
The code snippet uses style to format the textarea, but I have tried rows and columns with no effect.
<td><div align="left">
                 <input name="long" type="textarea" id="long" style="width: 500px; height: 60px" value="" class="field2"/>
              </div></td>

Open in new window

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Consider using TinyMCE for your textarea processor.  It is not perfect, but it can handle this situation pretty well.

http://tinymce.moxiecode.com/

HTH, ~Ray
Avatar of llakow
llakow

ASKER

Ray
Looks like a great tool, but unless I am missing something, it will impose another level of technophobe / computer interaction on the intended user base.
The users are generating lists of stock symbols they wish to track from a variety of sources that will allow them to create either csv or txt files as downloads.  I need to find a way for them to simply open the file with the appropriate program (a spreadsheet for csv and Notepad for txt, select all, copy and then paste into the text box.
Trying to get most of them to learn additional controls for each textarea they need to input will discourage many from using the system.
Avatar of llakow

ASKER

It occurs to me that a javascript function using onchange to trigger a parser to strip the offending non printing characters from the input, replacing them with spaces, might be a possible solution, but finding and replacing nonprinting characters in a string is beyond my limited javascript skills.
paste your code here as we'll need to see the javascript to sort out that for you
or a url to the site so we can view source
Avatar of llakow

ASKER

Hmmm...Paste which code here?
Right now, the only code is the input textarea code listed in the initial question.
The javascript checkFields function I referred to is unrelated to this issue - it just checks that the required input fields aren't null when the form is submitted.
If you want to view the page on the actual site, you'll need to register at symbolsifter.com, login, select track stocks, and then create a list.
The code is about as basic as you can get - a simple html input form.
Do it in Firefox and it works perfectly.  Do it in IE and all you get is the first line
WFLong.txt
I use spry text area's as I use cs4 and they work fine so if your using cs4 use a spry textarea
Avatar of llakow

ASKER

I'm not using cs4 - but I am curious what attributes cs4 can add to a textarea input field on a form so that a browser will treat it differently?
ASKER CERTIFIED SOLUTION
Avatar of llakow
llakow

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial