Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7186283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:35:58+00:00 2026-05-28T18:35:58+00:00

New to sencha touch here. I’ve checked out quite a few tutorials online. I

  • 0

New to sencha touch here. I’ve checked out quite a few tutorials online. I am having an issue trying to get the value of a text field. The error I am getting when I click my login button is Uncaught TypeError: Cannot call method 'getValue' of undefined. Does that mean my Ext.getCmp is undefined then? I have this panel wrapped in the regular Ext.setup....onReady:.....

var login = new Ext.Panel({
    height:'auto',
    scroll:'vertical',
    layout:{
        type:'vbox',
        align:'center'
    },
    items:[
        {
            cls:'launchscreen',
            html:logo,
            padding:10
        },
        new Ext.form.FormPanel({
            width:300,
            cls:'loginform',
            items:[
                {
                    xtype: 'fieldset',
                    title: 'Login',
                    items: [
                        {
                            xtype: 'textfield',
                            name : 'username',
                            label: 'Username',
                            labelWidth: 85
                        },
                        {
                            xtype: 'passwordfield',
                            name : 'password',
                            label: 'Password',
                            labelWidth: 85
                        }
                    ]
                },
                {
                    xtype: 'button',
                    text: 'Submit',
                    ui: 'confirm',
                    handler:function()
                    {
                        alert(Ext.getCmp('username').getValue());
                    }
                }
            ]
        })
    ]
});

EDIT: I was able to get the value if I set the id property on the text field. I’ve seen some example where the id isn’t set and they get the value based off the name property. So I guess my question now is am I supposed to get the value based off id or name?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:35:59+00:00Added an answer on May 28, 2026 at 6:35 pm

    Using Ext.getCmp() you have to provide the ID of the element whose value you want. See Sencha API doc’s for this:

    getCmp( String id )
    This is shorthand reference to Ext.ComponentManager.get. Looks up an existing Component by id
    Parameters
    id : String
    The component id

    You can also find the element by name, but I think it is faster by ID but perhaps also a bit expensive for the browser’s engine. Can’t say anything about that really.

    Anyway, finding field by name is possible by using findField() method. With this method you should provide the id or name of the field that you want. See API doc: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.Basic-method-findField

    Example:

    var fieldValue= Ext.getCmp("YourFormID").getForm().findField("FieldName").getValue();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Sencha Touch have a bit of an issue. Quite simply I've
I've seen quite a few examples of a sencha touch app with a nestedList
I am currently playing with Sencha Touch, and I'm trying to get data from
I am quite new to sencha touch and sencha touch charts, and I am
I am new bee to sencha touch. I have started with few samples and
I'm new in Sencha Touch and I'm trying to create a TabPanel with a
I am new to sencha touch and I am trying to use the back
I’m new to Sencha Touch and still not quite confident with its data handling
I'm new to Sencha Touch and just trying to put a Toolbar inside of
My Setup Safari 5.1.2 (Macintosh) Sencha Touch 1.1 The Issue The process I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.