I’ve got a function:
function saveToJ(feature) {
var str = new OpenLayers.Format.GeoJSON(out_options).write(feature, true);
str = str.replace(/,/g, ', ');
strObj = Ext.decode(str);
if(strObj.properties.name == null) {
...
} else {
if(!win) {
win = new Ext.Window({
title : "Edit",
items : [editPanel],
closeAction : 'hide'
});
}
win.show();
}
}
}
and a panel:
var editPanel = new Ext.form.FormPanel({
width : 400,
defaults : {
width : 230
},
defaultType : 'textfield',
items : [{
fieldLabel : 'Name',
name : 'name',
allowBlank : false,
}],
buttons : [editSaveBtn, editDeleteBtn]
});
what i want to do is to use strObj.properties.name as a value for the field on my panel.
but value: strObj.properties.name gives an error that strObj is undefined.
strObj is declared outside of the saveToJ function.
What am i doing wrong?
it was simple, just use:
editPanel.getForm().findField('name').setValue(strObj.properties.name);