tags:

views:

344

answers:

4

When I try to set the value of a textarea with a large text (for example a string length of 600000), the browser (Firefox 3.5.3) freezes.

The text is in 1 line so text wrapping needs to happen by the textarea itself. I think this causes the problem.

Does anyone know a fix for this problem?

+5  A: 

The maximum size for a textarea in Firefox is 64K (it could be just 32K, I can't recall). 600,000 characters is larger than that. If the size of the text that you're pasting into the textarea does in fact exceed that size, then there's nothing you can do about it.

Of course, one alternative would be to put some type of restriction on the data going into the field and then give the user some feedback as to why their data won't fit.

Tom
The more you know. Thanks for that info.
Martin Hohenberg
A: 

There is basically no controls that are designed for that kind of data sizes, because it simply doesn't make any sense to present all that informaton at once to the user.

Even if the control would handle the data, it would be practically unusable as you can't navigate through the data in any reasonable fashion.

Guffa
A: 

Like what other people are saying, this may not be the best solution depending on what sort of data you are trying to handle.

If you really need this, you may want to consider using Javascript and having an "editable" DIV. I've never tried this myself, but I've always kept it as an option in case I wanted an alternative to the very limited textarea form element.

I would just start here and do a bit more research into the topic:

http://stackoverflow.com/questions/1188581/how-to-make-a-div-editable-cross-browser

Theoretically this shouldn't have any limit on how much text it contains or you can paste into it as far as I know.

theotherlight
A: 

Hi,

The answer comes certainly a bit late, but in order to speed up your paste operations of large chunks of text in a textarea or editable div, simply disable autocomplete:

<div onClick="this.contentEditable='true';" autocomplete="off">
  lorem ipsum dolor lorem ipsum dolorlorem ipsum dolor
</div>

Best regards,

Philippe Lang Attik System

plang