PDA

View Full Version : [FIXED]Ext.form.Basic.getValues()



mdavis6890
21 Feb 2011, 9:03 AM
I was having some trouble with getting the proper values from comboboxes in my form. I found this override to fix the problem for me:




Ext.override(Ext.form.Basic, {
getValues: function(asString, dirtyOnly, includeEmptyText) {
var values = {};

this.getFields().each(function(field) {
if (!dirtyOnly || field.isDirty()) {
var name = field.getName(),
//val = field.getSubmitValue(), // Gets raw value rather than actual value
val = field.getValue(), //My fix, which gets the proper value.
bucket;
if (val !== null) {
if (includeEmptyText && val === '') {
val = field.emptyText || '';
}
if (name in values) {
bucket = values[name];
if (!Ext.isArray(bucket)) {
bucket = values[name] = [bucket];
}
bucket.push(val);
} else {
values[name] = val;
}
}
}
});

if (asString) {
values = Ext.urlEncode(values);
}
return values;
},

});

evant
22 Feb 2011, 11:03 PM
This has been resolved, thanks for the report.

mdavis6890
23 Feb 2011, 8:00 AM
I'm a little new at this, so can you help me understand what "resolved" means?

Did you fix it my way, or some other way? Can you post the final code block?

Best,
Michael