How to get data from field to textarea
I have following code:
{
fieldLabel : Label,
name : 'question[text]',
xtype : 'textarea',
allowBlank : false,
blankText : "Enter at least something",
height : 160
},
{ xtype: 'button',
text: 'Change Text',
handler: function(){
Ext.Msg.prompt('Enter Text', 'Enter new text for Action 1:', function(btn, text){
if (btn == 'ok' && text) {
var textz = 'Hi, ' + text;开发者_开发问答
action.setText(textz);
}
});
}
},
Works fine, when i click on button appears MessageBox where i can input something. How to do, if I something entered, and clicked on Ok, my text that i entered will be in my textarea?
Thank you for help!
try this :
{
fieldLabel : Label,
name : 'question[text]',
id : 'txtareafield',
xtype : 'textarea',
allowBlank : false,
blankText : "Enter at least something",
height : 160
},
{ xtype: 'button',
text: 'Change Text',
handler: function(){
Ext.Msg.prompt('Enter Text', 'Enter new text for Action 1:', function(btn, text){
if (btn == 'ok' && text) {
var textz = 'Hi, ' + text;
action.setText(textz);
Ext.getCmp('txtareafield').setValue(textz):
}
});
}
},
精彩评论