indapublic
indapublic

Reputation: 2328

Sencha Touch 2.1. ItemId is not working?

try create form login in Sencha Touch 2.1

...
xtype: 'fieldset',
title: 'My Login',
items: [
    {
        xtype: 'emailfield',
        placeHolder: 'Username',
        itemId: 'userNameTextField',
        name: 'userNameTextField',
        required: true
    },
    {
        xtype: 'passwordfield',
        placeHolder: 'Password',
        itemId: 'passwordTextField',
        name: 'passwordTextField',
        required: true
    }
]
...

but in Chrome console

<input id="ext-element-14" class="x-input-el x-form-field x-input-email" type="email" autocapitalize="off" placeholder="Username" name="userNameTextField">

why ItemId is not working?

Upvotes: 0

Views: 3783

Answers (2)

Chu Bao .Dev
Chu Bao .Dev

Reputation: 319

You can call itemid in Sencha Touch by using : "#itemID"

var field = frmLogin.query("#userNameTextField")[0];

Hope can help you have same problem.!

Upvotes: 0

ThinkFloyd
ThinkFloyd

Reputation: 5021

As per

http://www.sencha.com/forum/showthread.php?196697-itemId-alone-not-working-for-ref-selectors&p=783360&viewfull=1#post783360 ,

Ext.ComponentQuery can only resolve a component using itemId if a parent component is referenced in the query so you are better off using id because I don't think you application would have many login panels and you can easily access these fields like:

var pwd = Ext.getCmp('passwordTextField');

Upvotes: 1

Related Questions