PDA

View Full Version : Ext.form.getValues returning only display string, not the value



ethraza
30 Jul 2007, 10:25 AM
Hi!

I'm using a Ext.form.Form and on submit, the post params are passed with the display string not the value string of the DataStore of ComboBox.
It's a bug in 1.1-rc1 or I'm doing something wrong?
Maybe because the SimpleStore is not intended for that? (But I looked into FireBug DOM and the value and display are both in there!)




$result = db("SELECT * FROM Localidades");
while ($e = mysql_fetch_object($result)) {
$uf .= "['$e->UF-$e->Descricao','$e->UF'],";
}
mysql_free_result($result);
$uf = rtrim($uf,",");


var uf_ds = new Ext.data.SimpleStore({fields: ['text','value'], data: [$uf]});

myForm.add(
new Ext.form.ComboBox({
fieldLabel: 'UF Origem',
mode:'local',
valueField:'value',
displayField:'text',
tabIndex:tidx+=1,
name:'UFOrigem',
typeAhead: true,
selectOnFocus: true,
width: 160,
triggerAction: 'all',
store: uf_ds
}));

myForm.on('beforeaction',function(){
ATW.addTab('Relatório de Embarques',this.url,Ext.apply(this.baseParams,this.getValues()),'tabRelEmb',false);
return false;
}
);
On beforeAction I do a getValues(), but even if a comment out this and let the default submit action of the form do the call, the value passed from ComboBox is the value of the displayField and not the one of the valueField.
I tryed to omit the valueField and the displayField because I'm using the mode='local', but in this case nothing appers inside the ComboBoxes.
Any clue?

Thanks!

kape123
24 Sep 2007, 3:39 PM
http://extjs.com/forum/showthread.php?t=11482&highlight=combobox+submit+valueField