触摸表单忽略提交的值

时间:2011-10-19 14:15:53

标签: sencha-touch extjs

我正在提交表单,但神奇地我的表单值不会发布。 onBeforeSubmit会触发预期值,我甚至可以在this.submit()之前执行this.getValues()

MyForm= function(config){
if ( typeof config !== 'object' ) { 
config.url='test.php';
// config.standardSubmit = true;
config.items= [{
    xtype: 'fieldset',
    title: 'Login Details',
    instructions: 'Please enter the information above.',
    defaults: {
        required: true,'
    },
    items: [{
        xtype: 'textfield',
        name : 'username'
    }, {
        xtype: 'passwordfield',
        name : 'password'
    }]
}];
var tbarBottom = {
    xtype: 'toolbar',
    dock: 'bottom',
    items: [{
        text: 'Login',
        ui: 'confirm',
        handler: function() {
            this.onLoginClick();
        },
        scope: this
    }]
};
config.listeners= {
    beforesubmit: function(formpanel, values, options) {
    console.log(values);//yup they are there

    },
    scope:this
}
config.dockedItems= [tbarBottom];

MyForm.superclass.constructor.call(this,config);
};


Ext.extend( MyForm, Ext.form.FormPanel,{

onResetClick: function() {
    this.reset()
},
onLoginClick: function() {
    console.log(this.getValues());//yup they are there
    this.submit()
}

});

TL; DR这提交给服务器,但我没有发布任何值,你知道为什么吗?

1 个答案:

答案 0 :(得分:0)

根据http://docs.sencha.com/touch/1-1/#!/api/Ext.data.Request-cfg-methodmethod的默认值为GET,应在配置对象中将其更改为POST。 (例如config.method='POST'),然后离开