Solved

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

Posted on 2009-07-05
8
466 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 110

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

717 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