diff --git a/src/GeoExt/plugins/PrintProviderField.js b/src/GeoExt/plugins/PrintProviderField.js index 7be8d137a..a2a1f6fed 100644 --- a/src/GeoExt/plugins/PrintProviderField.js +++ b/src/GeoExt/plugins/PrintProviderField.js @@ -155,11 +155,14 @@ Ext.define('GeoExt.plugins.PrintProviderField', { */ onFieldChange: function(field, records) { var record; - if (Ext.isArray(records)) { - record = records[0]; - } else { - record = records; - } + // textfields records parameter is a string, comboboxes are records + if(Ext.isString(records) === false){ + if (Ext.isArray(records)) { + record = records[0]; + } else { + record = records; + } + } var printProvider = this.printProvider || field.ownerCt.printProvider; var value = field.getValue(); this._updating = true; diff --git a/tests/plugins/PrintProviderField.html b/tests/plugins/PrintProviderField.html index 18d478594..9f49d2d50 100644 --- a/tests/plugins/PrintProviderField.html +++ b/tests/plugins/PrintProviderField.html @@ -190,6 +190,30 @@ t.eq(printProvider.layout.get("name"), printProvider.layouts.getAt(1).get("name"), "Layout value updated in printProvider."); } + function test_textfield_onFieldChange(t) { + t.plan(1); + + var printProvider = Ext.create('GeoExt.data.MapfishPrintProvider', { + capabilities: printCapabilities, + customParams: {foo: "bar"} + }); + var plugin = Ext.create('GeoExt.plugins.PrintProviderField', { + printProvider: printProvider + }); + var field = Ext.create('Ext.form.field.Text', { + name: "foo", + plugins: plugin, + listeners: { + dirtychange: function(){ + // this fires after the change event + t.eq(printProvider.customParams.foo, "foobar", "Custom text field value updated in printProvider."); + } + } + }); + + field.setValue("foobar"); + } + function test_onProviderChange(t) { t.plan(3);