Solved

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

Posted on 2009-07-05
8
455 Views
Last Modified: 2013-12-13
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

0
Comment
Question by:llakow
  • 5
  • 2
8 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 24781094
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
0
 

Author Comment

by:llakow
ID: 24781135
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.
0
 

Author Comment

by:llakow
ID: 24781150
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.
0
 
LVL 30

Expert Comment

by:IanTh
ID: 24781224
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
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:llakow
ID: 24781403
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
0
 
LVL 30

Expert Comment

by:IanTh
ID: 24788183
I use spry text area's as I use cs4 and they work fine so if your using cs4 use a spry textarea
0
 

Author Comment

by:llakow
ID: 24788276
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?
0
 

Accepted Solution

by:
llakow earned 0 total points
ID: 24799240
The problem was so simple it escaped everyone's notice.
I had designated it as in <input field, type=textarea ...instead of making it a <textarea...></textyarea>
Changed the tag, problem solved.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to count occurrences of each item in an array.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now