Extjs 3.4 Combobox在表单提交后未显示有价值的数据

时间:2014-02-04 11:15:18

标签: javascript php extjs

我有一个xtype:combobox如下。当我提交表单时,它显示显示字段值而不是值字段。你能告诉我问题在哪里吗?这是我的代码。当我在php中提交表单时。

        Ext.onReady(function(){ 
        var store = new Ext.data.SimpleStore({
        fields: ['dataFieldName', 'displayFieldName'],
        data: [['MON', 'Month']],       
        });    
        var fp = new Ext.FormPanel({
        title: 'Check/Radio Groups Example',
        id:'simpleform',
        url:'tt.php',
        frame: true,
        labelWidth: 110,
        width: 600,
        renderTo:'form-ct',
        bodyStyle: 'padding:0 10px 0;',
        items: [{
        store: store,
        fieldLabel: 'ComboBox',
        displayField: 'displayFieldName',   
        valueField: 'dataFieldName',        
        typeAhead: true,
        forceSelection: true,
        mode: 'local',
        triggerAction: 'all',
        selectOnFocus: true,
        editable: true,
        xtype: 'combo',
        }],
        buttons: [{
        text: 'Save',
        handler: function(){                        
        Ext.getCmp("simpleform").getForm().submit({                      
        success: function() { }          
        });         
        }
        }]
        });
        });

在php中显示

  Array
  (
    [vsn] => Month
  )

它应该显示MON。你能告诉我问题在哪里吗?

1 个答案:

答案 0 :(得分:0)

尝试设置hiddenName

combobox属性

如果指定,则动态生成具有此名称的隐藏表单字段以存储字段的数据值(默认为基础DOM元素的名称)。组合值在表单提交期间自动发布所必需的。

参考docs