Results 1 to 9 of 9

Thread: Incorrect Value of the combobox

  1. #1

    Red face Incorrect Value of the combobox

    I have the combobox, which works properly but sends incorrect value after the form submit.

    Here's how the combo is defined:

    new Ext.form.ComboBox({
    name: 'customerNumber',
    fieldLabel: 'Customer Number *',
    store: Ext.arrow.customerNumberDS,
    displayField:'na',
    valueField: 'nu',
    minChars : 4,
    typeAhead: true,
    mode: 'remote',
    queryParam: 'query',
    hideTrigger: true,
    selectOnFocus:true,
    triggerAction: 'all',
    width: 250

    I've tried using hiddenName: 'customerNumber' but it did not help. If name attribute is removed then no value is sent at all.

    When I submit the combo to server, I am getting the displayField instead of the valueField.

    What is wrong ?..this is very urgent !

    Thanks for your help

    Mikhail

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

    Default

    Mikhail, can you post the code for the store and combo in code tags? hiddenName should work.

  3. #3

    Default Store code for the research

    Here's my store code:

    var productStore = new Ext.data.Store({
    proxy : new Ext.data.HttpProxy({
    method: 'POST',
    prettyUrls: false,
    url: '/customappsweb/productsearchservlet'
    }),
    reader: new Ext.data.JsonReader({
    root: 'rows',
    totalProperty: 'total'
    }, [
    {name: 'partNumber'},
    {name: 'manufacturer'},
    {name: 'description'},
    {name: 'category'},
    {name: 'list'},
    {name: 'myPrice'},
    {name: 'status'},
    {name: 'qty'}
    ]),
    remoteSort: true
    });

    productStore.on('beforeload', function() {
    productStore.baseParams = productSearchFm.getForm().getValues();
    });
    productStore.setDefaultSort('partNumber', 'asc');

    Here's the Search button code:

    buttons: [{
    text: 'Search',
    handler: function() {
    productStore.removeAll();
    productStore.load({
    params:{start:0, limit:prodPageSize},
    waitMsg:'Searching....'
    });
    }
    }]

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

    Default

    your fields don't match the displayField and valueField. i'm confused

  5. #5

    Default Explanation

    There are 2 stores here:

    1st store is used to populate the combobox, when somebody starts typing in the box:

    Ext.arrow.customerNumberDS = new Ext.data.Store({
    url: '/customappsweb/getcustomernumber',
    reader: new Ext.data.JsonReader({
    root: 'rows'
    }, [
    {name: 'nu'},
    {name: 'na'}
    ])
    });

    2nd store is used to search for the values selected on the form including the combobox listed above.

    The first part works, when I start typing the customer number in the combobox I am getting back the correct values and combo is populated correctly.

    Example: Typed 100000 got back few records.
    Selected: 1000001 --> CDW (the text of the record in the combobox), value is 1000001

    When I submit I 'd like to send value 100001 not the full text with --> CDW included !!!!

    Is it clear now ?

    Mikhail

  6. #6

    Default

    Any ideas ?

  7. #7
    Sencha Premium User
    Join Date
    May 2009
    Posts
    79

    Default

    Did you find a solution to this? I am running into the same problem.

  8. #8

    Default Solution

    Yes, I did...this was totally my problem. I had in one place incorrect reference on the field.
    HiddenName should work for you.

    If it is still does not work, include the value in the display field and then parse on the server.

    Mikhail

  9. #9
    Sencha Premium User
    Join Date
    May 2009
    Posts
    79

    Default

    Wow, oddly enough I was trying to that earlier, and it wasnt working, but I tried it again, and I dont know what I changed, but its working now! Thanks for the motivation to try it again ;-)

Posting Permissions

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