Results 1 to 2 of 2

Thread: [SOLVED] Problem Loading Form Data to Combo Box

  1. #1
    Ext User
    Join Date
    Aug 2007
    Posts
    78
    Vote Rating
    0
      0  

    Default [SOLVED] Problem Loading Form Data to Combo Box

    Hello Hello!

    Having an odd problem.
    I have a combobox in a form which successfully loads its values from a JSON Store.

    On the page load, the form also loads its data from a JSON Store.
    The values for the combo box are the numeric ID's.

    However, when the page loads, instead of displaying the correct associated value, the combox displays the loaded value from the form (i.e '3')

    Here's my store for the combobox
    Code:
    var cellstore = new Ext.data.Store({
    	autoLoad:true,
    	proxy: new Ext.data.HttpProxy({url: './ajax/getCarriers.php'}),
    	reader: new Ext.data.JsonReader({
    		root: 'root'
    	},
    	[
    	{name: 'ID'},
    	{name: 'Name'}
    	])
    });
    Here's the data provided by the store, that does successfully populate the combobox:
    Code:
    {"root":
    [{"ID":"1","Name":"Alltel"},
    {"ID":"2","Name":"AT&T \/ Cingular"},
    {"ID":"3","Name":"Boost Mobile"},
    {"ID":"4","Name":"Sprint (PCS)"},
    {"ID":"5","Name":"Sprint (Nextel)"},
    {"ID":"6","Name":"T-Mobile"},
    {"ID":"7","Name":"Verizon"},
    {"ID":"8","Name":"Virgin Mobile"}]}
    Here's my combobox code:
    Code:
    						xtype:'combo',
    						name: 'Phone_Secondary_Cell_Carrier',
    						triggerAction: 'all',
    						store: cellstore,
    						displayField: 'Name',
    						emptyText: 'Select A Carrier',
    						selectOnFocus:true,
    						fieldLabel: 'Secondary Cell Carrier'
    My form json reader is loading the value '3' to the combobox, but instead of displaying "Boost Mobile" It displays "3"

    Is there perhaps something I must change in my JSON reader for the form?

    Thanks!

  2. #2
    Ext User
    Join Date
    Aug 2007
    Posts
    78
    Vote Rating
    0
      0  

    Default

    Solved...

    I was missing valueField in the combobox config

Posting Permissions

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