Hi everybody,
I have a form displaying an ImageMedia which can be changed and saved. The media itself is read from the database at the start of the application and placed into a global variable. This global is the dataprovider of the ImageMedia field.
When I try to change the picture (action “load media”) it displays correctly the new one. But when I click on the button to save it, the field becomes blank, as if the picture was deleted.
Here are the properties of the field:
[attachment=0]Capture.PNG[/attachment]
The global variable is of type MEDIA.
And here is the code run when you clikc on the Save button:
function RecordSettings() {
if(forms.frm_settings.controller.find())
{
forms.frm_settings.fld_personnel_id = 0;
forms.frm_settings.fld_setting = "comp_%";
forms.frm_settings.controller.search();
}
for (var i = 1; i <= forms.frm_settings.controller.getMaxRecordIndex(); i++)
{
forms.frm_settings.controller.setSelectedIndex(i)
if (utils.stringRight(forms.frm_settings.fld_setting,5) == "_pict")
{
forms.frm_settings.fld_picture = globals["g_setting_"+forms.frm_settings.fld_setting];
}else{
forms.frm_settings.fld_value = globals["g_setting_"+forms.frm_settings.fld_setting];
}
}
databaseManager.saveData();
}
As you can see the global is not modified. I have checked “g_setting_”+forms.frm_settings.fld_setting, it is correct (generated string is the same as the global variable name).