Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > custom form control View modes: 
User avatar
Member
Member
lavinia.elena-yahoo - 4/1/2010 3:29:33 AM
   
custom form control
Hello,

I have the following scenario:

I create a new document type named CustomArticle. As fields i want to set Title, Summary, Description and a few image fields (Pic1, Pic2, Pic3...).
For each image field, i want to save in the database the ImageNodeGuid. I can achieve this by displaying for each image field in the editing form
a field of type "Image Selection". Then, if i set 10 images, i will end up with 10 columns in the CustomArticle table holding GUIDs.

To avoid this, i would like to create a new Form Control that will be used for selecting the related images from the content tree. And i would like to save the related images in a separate table that will have the following columns:
ID, ImageNodeGUID, DocumentID

I would very much appreciate if you could give me a suggestion for an elegant way of implementing this. And how can i place a few "Image Selection" controls in a custom form control?

Thank you,
Lavinia

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 4/2/2010 10:36:35 AM
   
RE:custom form control
Hello Lavinia,

a separate table is a possible solution for such setup, however you fortunately don't need to do that, since there are Document attachments. You can specify only one attribute for the images in your document type, like shown in the linked article and further in Unsorted attachments.

Usage of document attachments in transformations is described in article Handling attachments in transformations.

Would this be suitable for your aims?

Regards,
Zdenek C.

User avatar
Member
Member
lavinia.elena-yahoo - 4/6/2010 8:05:46 AM
   
RE:custom form control
Hi Zdenek,

The problem is that we want to be able to provide description for the images and use meaningful names and not GUIDs like it is implemented with document attachments.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 4/13/2010 5:40:09 PM
   
RE:custom form control
Hi,

I believe that attachment names should not be a problem. You can either use the attachments controls with appropriate transformations, or you an write your own transformation functions that could use methods of AttachmentManager class to get and return AttachmentName and AttachmentExtension values, etc.

As for the attachments descriptions... this is currently not supported in DB model yet, however it may be possible. I can create a requirement for this to be implemented in some of the next versions, if you would be interested. Please let me know.

Best regards,
Zdenek