View Full Version : combo problrm

21 Jul 2009, 10:03 PM

I am huving a problem with the combo. its not taking the valueField properly. My value field is agentid but when i m clicking the submit button it is always giving an alert of the agentinfo only even after submition of the from its passing agentinfo as combo value.

Plz help.

<form action="abcd.html" method="get">
<input type="text" id="local-states" size="20"/>
<input type="submit" value="Submit" onclick="doClick()"/>

function doClick(){


var agentsStore = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: 'xmlstore.xml'}),
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Agent" tag
record: 'Agent'
}, [
'agentid', 'agentinfo'
var combo = new Ext.form.ComboBox({
hiddenName: 'local-states',
store: agentsStore,
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a state...',
applyTo: 'local-states',
displayField: 'agentinfo',
valueField: 'agentid'

<?xml version="1.0" encoding="UTF-8"?>
<agentinfo> - 10560</agentinfo>
<agentinfo> - 10565</agentinfo>


21 Jul 2009, 11:43 PM
you should add a renderer to position it's data.

// renderer for value and display
Ext.util.Format.comboRenderer = function(combo){
var record = combo.findRecord(combo.valueField, value);
return record ? record.get(combo.displayField) : combo.valueNotFoundText;

// Create Combobox (I make this external and place the variable in the grid or toolbar)

var comboProject = new Ext.form.ComboBox({
typeAhead : true,
triggerAction : 'all',
lazyRender : true,
mode : 'local',
store : new Ext.data.ArrayStore({
id: 0,
fields: [
valueField : 'myId',
displayField : 'displayText'

// Add this to your columns / items section
header: 'Project',
dataIndex: 'project',
sortable: true,
width: 150,
editor: comboProject, // specify reference to combo instance
renderer: Ext.util.Format.comboRenderer(comboProject)


22 Jul 2009, 12:02 AM
That's completely unrelated advise!

I think that this is a conflict with id vs. name. You are using the same id for the input as the hiddenName.

You probably need to use a different id.

22 Jul 2009, 1:16 AM
Hey condor,

Thanks 4 ur reply,
I fixed the issue. I was using something else in the hiddenName. I replaced it with valueField name and it solved the issue.

i changed hiddenName: 'local-states' to hiddenName: 'agentid' .
agentid is mu valueField name.

I have just started using ext-js.i dont have a lot knowledge in it.
Am i fixed the issue in the rite way ???


22 Jul 2009, 1:44 AM
Yes, you either had to change the id of the input or the hiddenName (you used the 2nd option).