View Full Version : ComboBox won't return valueField

1 Mar 2010, 9:32 PM
I am having an issue making the combobox select a displayField and make it think that I clicked on the comboBox and told it that selection.

This is my code:

var usersComboBox = new Ext.form.ComboBox({
fieldLabel: 'To',
triggerAction: 'all',
mode: 'remote',
store: optionsStore,
valueField: 'id',
displayField: 'name',
editable: false,
activate: function(){
}I have a DataSore for this called optionsStore:

var optionsStore = new Ext.data.Store({
autoLoad: false,
url: '../../../messaging/inc/action.php?list=to_options',
reader: new Ext.data.JsonReader({
root: 'to_options',
id: 'id',
fields: ['id', 'name', 'group']
});This data store returns:

{"to_options":[{"id":"all_users","name":"All Users","group":"User Groups"},{"id":"all_admins","name":"All Administrators","group":"User Groups"},{"id":"all_non_admins","name":"All Non-Administrators","group":"User Groups"}}]}Then I have my reply function

function replyMessage(){
var selectedUser = userGrid.getSelectionModel().getSelected();
url: '../../../messaging/inc/action.php?list=message',
params: {list: 'message',
id: selectedUser.get('id')
method: 'POST',
success: function(response) {
if (response.responseText && response.responseText.length > 0 && response.responseText.indexOf('success') > -1) {
eval('config = (' + response.responseText + ')');
if (config.success === true) {

emailSubjectText.setValue("RE: " + config.data.subject);

failure: function(f,a){

}This data returns:

{success: true,data:{"from":"User, Test","subject":"This is a test Subject","body":"This is a test body"}}I currently have the program putting up the "from" which in the case would be "User, Test" but it is not actually putting that selection in, it is just putting that name in there. I need it to put the selection in that way I can pull the id from it and send that to the server. I know I am doing something wrong on the 'usersComboBox.setValue(config.data.from).selectByValue();'

Thank you for your help ahead of time!,?