Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamically changing textbox to multiline

58 views
Skip to first unread message

vin...@gmail.com

unread,
Sep 8, 2012, 1:36:12 AM9/8/12
to
I am trying to dynamically change a single line textbox to multiline when a user pastes in text containing newline characters.

The problem is that when I do "setAttribute('multiline', true)" the textbox is converted to multiline, but the value in the textbox is lost. Is this a bug or am I missing something?

Thanks for the help
Aurimas

Neil

unread,
Sep 8, 2012, 1:35:29 PM9/8/12
to
vin...@gmail.com wrote:

>I am trying to dynamically change a single line textbox to multiline when a user pastes in text containing newline characters.
>
>The problem is that when I do "setAttribute('multiline', true)" the textbox is converted to multiline, but the value in the textbox is lost. Is this a bug or am I missing something?
>
>
Changing the textbox to multiline is achieved by deleting the HTML input
element and creating a textarea element in its place. There is some
ancient code that might copy the value from one to the other but offhand
I don't even know if it gets a chance to run. Even if it did work you
would probably want to preserve the selection range.

--
Warning: May contain traces of nuts.

Neil

unread,
Sep 9, 2012, 6:20:54 AM9/9/12
to
Neil wrote:

> vin...@gmail.com wrote:
>
>> I am trying to dynamically change a single line textbox to multiline
>> when a user pastes in text containing newline characters.
>>
>> The problem is that when I do "setAttribute('multiline', true)" the
>> textbox is converted to multiline, but the value in the textbox is
>> lost. Is this a bug or am I missing something?
>
> Changing the textbox to multiline is achieved by deleting the HTML
> input element and creating a textarea element in its place. There is
> some ancient code that might copy the value from one to the other but
> offhand I don't even know if it gets a chance to run.

The code I was looking at doesn't run in the case of converting a
textbox to multiline, so you'll have to save the value manually.
0 new messages