开发者

How to get data from field to textarea

开发者 https://www.devze.com 2023-03-06 21:43 出处:网络
I have following code: { fieldLabel: Label, name: \'question[text]\', xtype: \'textarea\', allowBlank: false,

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):
                    }
                });
            }
        },
0

精彩评论

暂无评论...
验证码 换一张
取 消