Reputation: 13
I wirte one HTML page with, the page can be displayed. But When I try to get the value of element in page, an error occurs. In JavaScript funtion, I want to use Ext.fly("loginname").getValue()
or document.getElementByName('loginname')
to get the input from User.
In Chrome, the Ext.fly('loginname')
is null
.
What is the wrong with me? Thanks everyone.
The code of HTML LOGINNAME page as below
items: [
{
columnWidth: .33,
layout: 'form',
items: [
{
xtype: 'textfield',
fieldLabel: '<font color="red">*</font>User Login',
allowBlank: false,
width: 180,
name: 'loginname',
enableKeyEvents: true,
msgTarget: 'under',
listeners: {
blur: function() {
changeValue();
}
}
}
]
Upvotes: 1
Views: 1507
Reputation: 2193
Ext js work completely different the way you think. In Ext js mostly we don't bother about the elements ,Its all about components and accessing the components have different ways. As of now seeing your code I can give you a solution which will work fine but it is not acceptable according to coding standards of Ext js.
Ext.ComponentQuery.query('textfield[name=loginname]')[0].getValue();
Upvotes: 2