Results 1 to 10 of 10

Thread: How to get password value in sencha touch 2??

  1. #1
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default How to get password value in sencha touch 2??

    Hi,

    I have a sencha touch password field like below:
    Code:
                                                       xtype : 'passwordfield',                                                                id : 'password',
                                                                    name: 'password',
                                                                    label : 'Password',
                                                                    labelWidth : '40%',
    I want to get the value of this field. I tried using getValue() method. But it is returning me null value.

    Code:
    merchantPwd : '#password',
    And then like this:
    Code:
    var pwd = this.getMerchantPwd().getValue();
    alert("password:" +pwd);
    Help...

  2. #2
    Sencha User
    Join Date
    Dec 2011
    Location
    Coimbatore
    Posts
    103
    Answers
    4

    Default

    Hi,

    Use
    Bad Practice using id
    Code:
    Ext.getCmp('
    password
    ').getValue()); //Using id
    Good Practice Using xtype

    Code:
    Ext.ComponentQuery.query('
    passwordfield'
    )[0].getValue(); //xtype


    Thanks
    Last edited by venkatesh.R; 27 Jul 2012 at 1:28 AM. Reason: edited for updating code

  3. #3
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default

    But still it is not giving me back..in log it is showing like this:

    02-11 17:41:13.810: I/Web Console(2260): password: at :901672837


    when i tried to display:

    console.log("password:" +pwd);

  4. #4
    Sencha User
    Join Date
    Dec 2011
    Location
    Coimbatore
    Posts
    103
    Answers
    4

    Default Password

    Hi,

    Try

    var password = Ext.getCmp('password').getValue());
    console.log(password );


    Thanks

  5. #5
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default

    Still empty string or null value..

  6. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    48
    Answers
    4

    Default

    Is password field the problem? Try changing it to textfield and check if u are having the same issue.
    Also see if other fields are also returning null.

  7. #7
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default

    No for textfield i am geting the value..

  8. #8
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default

    Code:
     var user = this.getMerchantUserid().getValue();
     alert("user name:" +user);
    I am getiing the user id here propely..only password field is creating the problem

  9. #9
    Sencha User
    Join Date
    Dec 2011
    Location
    Coimbatore
    Posts
    103
    Answers
    4

    Default Password value

    Hi,

    Have u got the password value? if not post view code to see the exact problem


    Thanks

  10. #10
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default

    Here is my view code:

    Code:
    Ext        .define(
                    'MyApp.view.TitlePanel',
                    {
                        extend : 'Ext.Panel',
                        alias : 'widget.login',
                        config : {
                            fullscreen : true,
                            ui : 'light',
                            items : [ {
                                xtype : 'panel',
                                id : 'LoginScreen',
                                items : [
                                        {
                                            xtype : 'image',
                                            docked : 'left',
                                            height : 130,
                                            id : 'Logoimage',
                                            ui : '',
                                            width : 170,
                                            src : 'app/images/logo.png'
                                        },
                                        {
                                            xtype : 'titlebar',
                                            cls : 'mytitlebar',
                                            docked : 'top',
                                            height : 100,
                                            ui : 'blue',
                                            items : [ {
                                                xtype : 'label',
                                                html : 'Teritree Business Portal',
                                                id : 'title',
                                                margin : 10,
                                                style : 'font: normal Bold 20px droid sans; color:#AB3951',
                                            } ]
                                        },
                                        {
                                            xtype : 'panel',
                                            id : 'LoginPanel',
                                            layout : {
                                                type : 'vbox',
    //                                            pack  : 'center',
    //                                            align : 'middle'
                                            },
                                            items : [
                                                    {
                                                        xtype : 'label',
                                                        html : 'Login with Teritree Business Credentials',
                                                        id : 'Loginlabel',
                                                        margin : '50 0 0 20',
                                                        style : 'font: normal Bold 24px droid sans',
                                                        ui : 'dark'
                                                    },
                                                    {
                                                        xtype : 'fieldset',
                                                        itemId : 'LoginField',
                                                        id: 'loginform',
                                                        width : 500,
                                                        margin : '20 0 0 0',
                                                        items : [
                                                                {
                                                                    xtype : 'textfield',
                                                                    id : 'user',
                                                                    name: 'username',
                                                                    style : 'font: Droid Sans',
                                                                    label : 'Login User id',
                                                                    labelWidth : '40%'
                                                                },
                                                                {
                                                                    xtype : 'passwordfield',
                                                                    id : 'password',
                                                                    name: 'password',
                                                                    label : 'Password',
                                                                    labelWidth : '40%',
                                                                } ]
                                                    },
                                                    {
                                                        xtype : 'button',
                                                        height : 40,
                                                        id : 'LoginBtn',
                                                        ui : 'orange',
                                                        margin : '20 0 0 150',
                                                        width : 180,
                                                        text : 'Login'
                                                    },
                                                    {
                                                        xtype : 'label',
                                                        html : 'If you don\'t have an account yet: Signup at <a href="url">business.teritree.com</a> ',
                                                        id : 'signup',
                                                        margin : '20 0 0 0',
                                                        style : 'font: normal droid sans'
                                                    } ]
                                        } ]
                            } ]
                        }
                    });

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •