Sencha touch 2 如何使用sencha touch获取表单值并将这些值插入数据库

Sencha touch 2 如何使用sencha touch获取表单值并将这些值插入数据库,sencha-touch-2,Sencha Touch 2,我想在数据库中存储登录表单的详细信息 在我看来,代码 Ext.define('SampleForm.view.LoginForm', { extend: 'Ext.form.Panel', //id:'loginform', requires:[ 'Ext.field.Email', 'Ext.field.Password' ], config: { fullscreen: true,

我想在数据库中存储登录表单的详细信息

在我看来,代码

Ext.define('SampleForm.view.LoginForm', {
    extend: 'Ext.form.Panel',
    //id:'loginform',
    requires:[
            'Ext.field.Email',
            'Ext.field.Password'
    ],
    config: {
        fullscreen: true,
        layout:{
            type:'vbox'
        },
        items: [
            {
                xtype: 'fieldset',
                title: 'Login',
        id: 'loginform',
                items: [
                    {
                        xtype:'textfield',
                        label:'Name',
                        name:'name'
                    },
                    {
                        xtype: 'emailfield',
                        name: 'email',
                        label: 'Email'
                    },
                    {
                        xtype: 'passwordfield',
                        name: 'password',
                        label: 'Password'
                    }
                ]
            },
            {
                xtype: 'button',
                width: '30%',
                text: 'Login',
                ui: 'confirm',
        action:'btnSubmitLogin'
            }
        ]
    }
});
内部控制器

Ext.define("SampleForm.controller.LoginForm", {
    extend: "Ext.app.Controller",

    config: {
        view: 'SampleForm.view.LoginForm',
        refs: [
        {
            loginForm: '#loginform',
            Selector: '#loginform'
        }
        ],
        control: {
            'button[action=btnSubmitLogin]': {
                tap: "onSubmitLogin"
            }
        }
    },
    onSubmitLogin: function () {

    alert('Form Submitted successfully');
    console.log("test");
    var values = this.getloginform();
    /* Ext.Ajax.request({
                      url: 'http://www.servername.com/login.php',
                      params: values,

                      success: function(response){
                          var text = response.responseText;
                          Ext.Msg.alert('Success', text);
                     }

                     failure : function(response) {
                           Ext.Msg.alert('Error','Error while submitting the form');
                           console.log(response.responseText);
                     }
              });*/
     form.submit({
           url:"http://localhost/sencha2011/form/login.php"
     });
    },
    launch: function () {
        this.callParent();
        console.log("LoginForm launch");
    },
    init: function () {
        this.callParent();
        console.log("LoginForm init");
    }
});
当我单击submit按钮时,会出现警报消息,但值未存储在数据库中。在控制台中,我收到此错误,未捕获的TypeError:Object[Object Object]没有方法“getloginform”


有谁能帮助我在数据库中插入值。

Javascript区分大小写。从

这些getter函数是基于您定义的ref和 始终遵循相同的格式-“get”后跟大写的ref 名字

要使用ref的getter方法,
loginForm
,并获取表单值,请使用:

var values = this.getLoginForm().getValues();

你最好改进你以前的帖子,然后再问一个重复的问题。用户1479606,谢谢你的建议,事实上我尝试过这种解决方案,正如你所说,但我没有得到o/p。这就是为什么我尝试了另一种方法。这次我成功地获得了警报框和consle窗口中的消息。但是值没有从表单中获得。这就是我再次提出问题的原因。我希望有人能帮助我Josh,我更改了var values=this.getLoginForm().getValues();对此,现在我在控制台中得到了错误,因为对象没有方法getLoginForm@lucky嗯,也许有一个潜在的问题。您是否收到任何其他错误?没有,此错误仅出现在控制台中。我想将这些值插入登录表(在数据库中)@lucky您找到了吗?@lucky您是如何解决第一个问题的?至于你的新问题,我建议你用相关代码和描述开始一个新问题。:)我可以帮你!