Hi, I need some help:
I want to show a picture from a ValueStorage in a form ImageField. The problem is, that the picture is not shown in the image field after file selection and picture address assignment. Here is my code:
Code |
---|
&AtServer Procedure SetPictureValueAtServer(StorageName, ClearPicture) ObjectValue = FormDataToValue(Object, Type("CatalogObject.Products")); If ClearPicture Then ObjectValue.PictureStorage = Undefined; Else ObjectValue.PictureStorage = New ValueStorage(GetFromTempStorage(StorageName)); EndIf; ObjectValue.Write(); ValueToFormData(ObjectValue, Object); EndProcedure &AtClient Procedure PictureClick(Item, StandardProcessing) StorageName = ""; FileName = ""; If PutFile(StorageName, FileName, FileName, True, UUID) Then SetPictureValueAtServer(StorageName, FALSE); EndIf; FormPictureAddress = GetURL(Object.Ref, "PictureStorage"); EndProcedure |
I have to close and reopen the form, then I see the picture. I'm using this code on open form:
Code |
---|
&AtClient Procedure OnOpen(Cancel) FormPictureAddress = GetURL(Object.Ref, "PictureStorage"); EndProcedure |
And, very strange, if I comment out GetURL in procedure OnOpen
Code |
---|
Procedure OnOpen(Cancel) // FormPictureAddress = GetURL(Object.Ref, "PictureStorage"); EndProcedure |
I dont't see picture after reopen form (shure), but if I select now a file (procedure PicturClick runs) it only works just once! Picture is shown imediatly before this message:
By the way, how can I suppress this message?
Thanks in advance for help
Michael