Results 1 to 10 of 10

Thread: [CLOSED][3.0r5636] form.getValues returns displayField

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Oct 2008
    Location
    Norway
    Posts
    106

    Default [CLOSED][3.0r5636] form.getValues returns displayField

    Maybe I'm the one at fault here, but consider the following test case:
    Code:
    var store = [['1','Label 1'],['2','Label 2']];
    
    var w = new Ext.Window({
      closable: true,
      width: 400,
      height: 400,
      items: new Ext.form.FormPanel({
        id: 'testformpanel',
        items: new Ext.form.ComboBox({
                                xtype:'combobox',
                                forceSelection:true,
                                fieldLabel: 'testlabel',
                                name: 'testinput',
                                mode:'local',
                                store: store,
                  listeners: {
                    select: function(c,r,i){
                    
                      // Returns the value properly
                      console.log('ComboBox value: '+c.getValue());
                      
                      // Returns the displayField instead of valueField
                      console.dir(Ext.getCmp('testformpanel').form.getValues());
                      
                    }
                  }
                })
      })
    });
    
    w.show();
    combobox.getValue() returns the currently selected value correctly, but form.getValues() returns the displayField, not the valueField.

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default No bug

    Code:
    hiddenName: 'testinput'

  3. #3
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    The header for the class in the API docs says

    Quote Originally Posted by TFM
    A ComboBox works in a similar manner to a traditional HTML <select> field. The difference is that to submit the valueField, you must specify a hiddenName to create a hidden input field to hold the value of the valueField. The displayField is shown in the text field which is named according to the name.
    You can lead a horse to water...

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    Quote Originally Posted by Animal View Post
    You can lead a horse to water...
    Isn't there a feature request that 'name' should be interpreted as 'hiddenName' if a 'valueField' and no 'hiddenName' is specified?

    ps. In Ext 3.1 you can even do:
    Code:
    name: 'text',
    hiddenName: 'value',
    submitValue: true
    to submit both the displayField and the valueField.

  5. #5
    Ext User
    Join Date
    Oct 2008
    Location
    Norway
    Posts
    106

    Default

    @condor
    Thank you. I had a feeling that I was missing something and I apologize for posting a false bug report.

    @animal
    Your post is redundant and your sarcastic comments only serves to hurt the general impression of the community support team.

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    I don't understand why you just posted that.

    People moan about the docs and then just obviously straight up don't read them!

  7. #7
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    And this question is asked with such MONOTONOUS regularity that it's in the FAQ.

    http://www.extjs.com/learn/Ext_FAQ_C...isplayField.22

  8. #8
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    To be honest, I think it's the design that is causing people pain.

    hiddenName isn't exactly easy to understand for newbies.

  9. #9
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    All the more reason to assume the name is the hiddenName when a valueField is specified.

    I couldn't find the feature request for this, so I created a new one.

  10. #10
    Sencha User
    Join Date
    Dec 2008
    Posts
    64

    Default

    Quote Originally Posted by [email protected] View Post
    To be honest, I think it's the design that is causing people pain.

    hiddenName isn't exactly easy to understand for newbies.
    Agreed. The problem is that Combobox tries to be two components at once, it behaves like a <select> (submit a hidden value that match what the user is seeing) but it also can behave likes a textfield (really submits what the user is seeing or typing).

    It's confusing and needlessly complex: the code should be forked into two components.

Posting Permissions

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