PDA

View Full Version : changing text area to textbox


o0O0o.o0O0o
01-30-2008, 12:37 AM
hi friends ,

i am using prototype javascript library to build the dit in place data grid
currently when i click on the column it displays the text area ,


var textarea = '<div id="'+obj.id+'_editor"><textarea id="'+obj.id+'_edit" name="'+obj.id+'" >'+obj.innerHTML+'</textarea>';
var button = '<div><input id="'+obj.id+'_save" type="button" value="SAVE" /> OR <input id="'+obj.id+'_cancel" type="button" value="CANCEL" /></div></div>';

new Insertion.After(obj, textarea+button);

but i want to change it to text input box ,
iam using the code below but it does not work

var textarea = '<div id="'+obj.id+'_editor"><input type = "text" id="'+obj.id+'_edit" name="'+obj.id+'" >'+obj.innerHTML';
var button = '<div><input id="'+obj.id+'_save" type="button" value="SAVE" /> OR <input id="'+obj.id+'_cancel" type="button" value="CANCEL" /></div></div>';

new Insertion.After(obj, textarea+button);

A1ien51
01-30-2008, 04:03 AM
In the future when posting a question terms like "it does not work" tells us nothing.

I am guessing your problem is "The value is not being set in the textbox, it is outside of it?"

I glanced at your code and on thing is you are not setting the value. You are placing the innerHTML after the element.

Your textbox should look like this when rendered

<input type="text" name="foo" id="foo" value="foo123" />

Yours is probbaly looking something like this:

<input type="text" name="foo" id="foo" />foo123


Hopefully you can figure out how to fix it.

Eric