0

I have a window. and some fields in it (textfield and button). Now i want to submit these details.

I get this error:

TypeError: button.up("form").getValues is not a function

Button function

buClicked : function (button,record) {
var val= button.up('form').getValues();
console.log(val.textfieldValue);
}

My Widow Definition

Ext.define('MyApp.view.WindowForm', {
    extend: 'Ext.window.Window',
    alias: 'widget.winform',
    id: 'winformid',
Illep
  • 16,375
  • 46
  • 171
  • 302

2 Answers2

3
var val= button.up('form').getForm().getValues();
Evan Trimboli
  • 29,900
  • 6
  • 45
  • 66
  • Thank you. This worked `var val= button.up('window').down('form').getForm().getValues();` – Illep Jul 24 '12 at 23:41
0

You are extending Window's class which is okay,but also add items config where ,you will include the xtype:form whose config has the the textfield and the buttons config something like this:

Ext.define('MyApp.view.WindowForm',
       {
           extend:'Ext.window.Window',
           id:'myformvin',
           items:[
               {xtype:'form',items:[{xtype:'textfield',fieldLabel:'My name',name:'myname'}],
                buttons:[{xtype:'button',text:'save',handler:function(btn){
                        var val =  btn.up('form').getForm().getValues(); 
                        console.log(val); //to confirm that you have the values
                    }
                }]
               }
           ]
       }
);
chiwangc
  • 3,566
  • 16
  • 26
  • 32
hudson2010
  • 71
  • 1
  • 6