View Full Version : Getting form values

18 Jan 2011, 7:32 AM

I'm building big application where I have a form that is dynamically built. For the sake of simplicity let's say my form consists of a radio group, combobox and few text fields.

This is my radio group form item:

xtype: 'radiogroup',
fieldLabel: 'Gender',
value: this.data.Gender,
items: [
{ boxLabel: 'Male', name: 'gender', inputValue: 1 },
{ boxLabel: 'Female', name: 'gender', inputValue: 2 }
This is my combo box form item:

xtype: 'combo',
name: 'status',
value: this.data.Status,
width: 120,
fieldLabel: 'Status',
emptyText: "Select status...",
forceSelection: true,
triggerAction: "all",
selectOnFocus: true,
typeAhead: true,
mode: 'local',
store: new Ext.data.ArrayStore({
fields: [
data: [
[0, 'Active'],
[1, 'Inactive']
valueField: 'Status',
displayField: 'StatusString'
This is my text field form item:

xtype: 'textfield',
name: 'title',
fieldLabel: 'Title',
value: this.data.TitleWhen I execute form.getValues() method it returns me object that looks like this:

gender: "2"
status: "Active" ==> should be "0"
title: "Some title"

When I execute form.getFieldValues() method it returns me object that looks like this:

gender: ext-comp-1583 ==> should be "2" but instead an object is returned
status: "0"
title: "Some title"

This is the object that I would like to get:

gender: "2"
status: "0"
title: "Some title"

But how?

18 Jan 2011, 7:36 AM
getValues() will work after you change Combobox 'name' to 'hiddenName'.

getFieldValues() doesn't work because of the strange getValue() implementation of CheckboxGroup and RadioGroup. I would suggest overriding these.

18 Jan 2011, 11:14 AM
That actually did the trick, thank you.