Results 1 to 5 of 5

Thread: Submit Combo Box Value Into Text Area

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    49
    Vote Rating
    0
      0  

    Default Submit Combo Box Value Into Text Area

    I have one combobox (Ext.form.ComboBox) and one textarea (xtype:'textarea',) inside a form window.

    Whenever the value inside combobox is selected, the value should submitted and filling the text area.

    I realize there is "select" method on combobox. But how to realize that functionality to transfer the selected value into text area.

    How to do that?

    Thanks in advance.

  2. #2
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Vote Rating
    90
      1  

    Default

    Hi,
    Try below code:
    Code:
                         xtype: 'form'
                        , items: [
                            {
                                xtype: 'combo'
                                , fieldLabel: 'Combo'
                                , name: 'combo'
                                , typeAhead: true
                                , triggerAction: 'all'
                                , lazyRender: true
                                , mode: 'local'
                                , store: {
                                    xtype: 'arraystore'
                                    , data: [
                                        ['Value01', 'v01'],
                                        ['Value02', 'v02'],
                                        ['Value03', 'v03'],
                                    ]
                                    , fields: ['display', 'value']
                                }
                                , valueField: 'value'
                                , displayField: 'display'
                                , listeners: {
                                    select: function () {
                                        this.nextSibling().setValue(this.getRawValue());
                                    }
                                }
                            },
                            {
                                xtype: 'textarea'
                                , fieldLabel: 'Text Area'
                                , name: 'textArea'
                            }
                        ]
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    49
    Vote Rating
    0
      0  

    Default It's work!

    Thanks a lot, sword-it. It's just work. Many many thanks.

    But, how to extend the functionality, so the textarea can filled by multiple value from selected combobox? Because for now, the text area only receipt only one selected value.

    Thanks in advance.

  4. #4
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Vote Rating
    90
      1  

    Default

    Hi!

    Try This:-

    Code:
     listeners: {
          select: function () {
               var textArea=this.nextSibling()
                 ,textAreaValue=textArea.getValue()
                 , comboValue=this.getValue()
                 ,newValue=textAreaValue.concat(comboValue);
                 textArea.setValue(newValue);
          }
      }
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  5. #5
    Sencha User
    Join Date
    Sep 2013
    Posts
    14
    Vote Rating
    1
      0  

    Default

    Hi Sword,

    similar way i want in tree,
    submit tree value into textarea.

    Thanks
    Jayaram

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
  •