0
votes

I have the below extjs combobox created for user to change an item through an API call. I have a specific tpl to display the values in a format which works fine when the select list gets populated. I have displayField showing when user selects an item from the list, which is great too. The problem is, when user selects and item and submits, I need to pull 2 values off of that selection. One value is gmiExchangeCode and the other value is gmiFuturesCode. I need to be able to get both of these values when user submits. The code below only sends the gmiDescription

}, {
        xtype: 'combo',
        autoLoad: true,
        hideTrigger: true,
        fieldLabel: 'Product',
        displayField: 'gmiDescription',
        hiddenName: 'gmiExchangeCode',
        valuefield: 'gmiExchangeCode',
        forceSelection: true,
        submitValue: true,
        name: 'exchange',
        queryMode: 'remote',
        queryParam: 'entry',
        typeAhead: true,
        minChar: 2,
        tpl: new Ext.XTemplate('*****'),
        store: {
            fields: ['text', 'value'],
            proxy: {
                type: 'ajax',
                url: '*****',
                reader: {
                    type: 'json'
                }
            },
            sorters: [{
                property: 'exchange',
                direction: 'ASC'
            }]
        },
        listeners: {
            select: function (combo, record, index) {
                exchangeCode.setValue(record.get('exchangeCode'));
            }
        }
    }, {
1

1 Answers

0
votes

By default, form submission sends all form elements values only (no extra field).

In order to send the second value you could create a hidden form field and set it ( see Sencha ExtJS Submit two values), and that way this hidden field would also be submitted

Another way around it is to pass some extra params to the submit action (if it is triggered manually), from https://docs.sencha.com/extjs/6.5.1/classic/Ext.form.action.Submit.html#cfg-params

Extra parameter values to pass. These are added to the Form's Ext.form.Basic#baseParams and passed to the specified URL along with the Form's input fields.

form.getForm().submit({
    url: 'panel.php',
    params: {
       data: Ext.encode(json)
    },
})