1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    16
    Vote Rating
    0
    raffael_epix is on a distinguished road

      0  

    Question Answered: Set value of textfield with the value of the list on click

    Answered: Set value of textfield with the value of the list on click


    Hi!
    I have a List and a listener on click on the item, its works! But how to set the Value of textfield / numberfield with the value of the listener? I have tested many ways:

    The listener:
    Code:
    listeners: {
    							select: function(view, record) {
    								//Ext.Msg.alert('Selected!', 'You selected ' + record.get('firstName'));
    								//Ext.getDom('telefone').setValue(record.get('firstName'));
    								//alert(document.getElementById('telefone').length+' - '+document.getElementById('telefone').value+' - '+record.get('phoneNumber'));
    								//document.getElementById('telefone').value = record.get('phoneNumber');
    							}
    						}
    The field:
    Code:
    xtype: 'numberfield',
    	                                    label: 'Telefone:',
    										labelWidth: 105,
    	                                    name: 'telefone',
    	                                    id: 'telefone'
    Thanks! =)

  2. You need to resolve the Sencha Touch field not the element.

    You can use ComponentQuery to go up to the form and then down to the field you want using the up and down methods

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,399
    Answers
    3549
    Vote Rating
    849
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You need to resolve the Sencha Touch field not the element.

    You can use ComponentQuery to go up to the form and then down to the field you want using the up and down methods
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    16
    Vote Rating
    0
    raffael_epix is on a distinguished road

      0  

    Wink


    This works!

    Thanks!

    The code:

    Code:
    var tab = this.up('tabpanel');								var form = tab.down('formpanel');
    								var field = form.down('numberfield');
    								field.setValue(record.get('phoneNumber'));
    =)

Thread Participants: 1

Tags for this Thread