Extjs4 打印表单值

Extjs4 打印表单值,extjs4,extjs4.1,Extjs4,Extjs4.1,我有以下表格。我需要打印用户为textfielduname输入的值?我该怎么做 Ext.create('Ext.form.Panel', { title: 'Basic Form', renderTo: Ext.getBody(), bodyPadding: 5, width: 350, // Any configuration items here will be automatically passed along to // the Ext

我有以下表格。我需要打印用户为textfield
uname
输入的值?我该怎么做

Ext.create('Ext.form.Panel', {
    title: 'Basic Form',
    renderTo: Ext.getBody(),
    bodyPadding: 5,
    width: 350,

    // Any configuration items here will be automatically passed along to
    // the Ext.form.Basic instance when it gets created.

    // The form will submit an AJAX request to this URL when submitted
    url: 'save-form.php',

    items: [{
        fieldLabel: 'NAME',
        name: 'uname'
    }],

    buttons: [{
        text: 'Submit',
        handler: function() {
            // The getForm() method returns the Ext.form.Basic instance:
            var form = this.up('form').getForm();
            if (form.isValid()) {

                // CONSOLE.LOG (FORM VALUES) ///////////////////////////////////////

            }
        }
    }]
});
使用该方法获取包含表单中所有字段值的对象:

var form = this.up('form').getForm();
if (form.isValid()) {
    var values = form.getValues();

    // log all values.
    console.log(values);

    // log uname value.
    console.log(values['uname']);
}
或者,使用该方法访问表单中的特定字段:

var form = this.up('form').getForm();
if (form.isValid()) {

    // log uname value.
    var field = form.findField('uname');
    console.log(field.getValue());
}

示例: