Sencha touch 如何在sencha touch中获取密码值?

Sencha touch 如何在sencha touch中获取密码值?,sencha-touch,sencha-touch-2,Sencha Touch,Sencha Touch 2,我有一个sencha touch密码字段,如下所示: xtype : 'passwordfield', id : 'password', name: 'password', label : 'Password', labelWidth : '40%', 我想得到这个字段的值。我尝试使用getValue()方法。但它会返回空值 在控制器中: merchantPwd : '#password', 然后像这样: var pwd = this.getMerchantPwd().getValue(

我有一个sencha touch密码字段,如下所示:

xtype : 'passwordfield',
id : 'password',
name: 'password',
label : 'Password',
labelWidth : '40%',
我想得到这个字段的值。我尝试使用getValue()方法。但它会返回空值

在控制器中:

merchantPwd : '#password',
然后像这样:

  var pwd = this.getMerchantPwd().getValue();
alert("password:" +pwd);

请帮助。

密码字段与其他输入字段的唯一区别在于,它的值仅通过显示无意义的字符(例如点或星)来隐藏。除了这个,它和其他输入字段一样

例如,在Sencha Touch文档代码编辑器和live预览中尝试这一点,它可以工作

Ext.create('Ext.form.Panel', {
    fullscreen: true,
    items: [
        {
            xtype: 'fieldset',
            title: 'Register',
            items: [
                {
                    xtype: 'emailfield',
                    label: 'Email',
                    name: 'email'
                },
                {
                    xtype: 'passwordfield',
                    label: 'Password',
                    name: 'password',
                    id: 'abc',
                    value: 'abc',
                }
            ]
        }
    ]
});
Ext.Msg.alert(Ext.getCmp('abc').getValue());
因此,我认为可能存在一些问题,例如:

  • 密码字段为空(实际上在本例中,它不显示任何内容,但不显示空值)
  • 您的控制器代码有一些问题。注意
    这个
    指针

我检查了..但它不会出现..即使我试图获取TextArea字段、Email字段的值,它也会返回null。