How to get a value from a combobox in a form after the field is populated by the database

extjs

I have a formPanel with two of the form items as comboboxes with their stores populated by the database. The value from comboBoxA needs to be used to get the value for comboBoxB however comboBoxA.getValue() (as well as getRawValue()) are returning undefined.

storeA.load();

var comboBoxA = Ext.getCmp(comboBoxAID);
storeB.baseParams.UserID = comboBoxA.getValue();
storeB.load();

Best Solution

As noted in the docs, store loading is asynchronous, so you have to do your additional processing within the appropriate callback:

storeA.on('load', function(){
    var comboBoxA = Ext.getCmp(comboBoxAID);
    storeB.baseParams.UserID = comboBoxA.getValue();
    storeB.load();
});
storeA.load();
Related Question