PDA

View Full Version : Problem with back-end fields containing '#'



sean.lanktree
09-01-2009, 10:56 AM
Normally, the code to pull in the results of an Ajax response looks like this:



Ext.Ajax.request({
url: 'vvcall.pgm',
params: {
pgm: 'simplepgm',
action: 'getCustRec',
xcusno: Ext.getCmp('XCUSNO').getValue()
},
success: function(response) {
var check = response.responseText;
if (check) {
var data = Ext.util.JSON.decode(response.responseText);
if (data.SUCCESS == '1') {
Ext.getCmp('XCNAME').setValue(data.CNAME);
This all works fine as long as the fields returned in "data" do not have a pound sign character (#) in the name. Suppose instead of data.CNAME it was data.#CNAME. In this case use the following work around:



Ext.getCmp('XCNAME').setValue(data['#CNAME']);