Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Custom Form Control: File attribute type View modes: 
User avatar
Member
Member
tspring-allegra - 11/19/2012 5:50:42 AM
   
Custom Form Control: File attribute type
Hi,

I've created a new custom form control, in which I have cloned the existing form control "Upload file". I basically wanted to add some custom code to create a new control with the same functions but also have the ability to check the selected upload file is not above a file size limit set within an extra property field within the control.

I got the new control to work fine, the problem I’m having is using the new control within the "field editing" sections of the CMS.

If I edit a form and create a new field and select the Attribute Type: File and select the new control I’ve created called "Upload file (with limit)". I can set the field to my new control type, set the limit value in the "Edit control setting" section, save and the field will work correctly within the form on the site. But if I go back to edit the field, the CMS thinks the field is now a Text attribute type that has an attribute size of 500. So I have to go through reselecting File and reselecting my new control name. The field has not actually changed to a Text type, it's just the CMS doesn’t recognise the new control is of a type File and therefore does not select it appropriately to edit.

My new control is an exact match for the default "Upload file" control (just with added backend code) and if I create a field using the original upload control and come back to edit it, it correctly displays as an attribute type of File. So I don't know why the CMS doesn’t do this for my new control?

In the CMSSiteManager/Development/Form controls/New control name/General tab, it's definitely set as "Use control for" File and in "Show control in" the "Default data type" is also set to File. I've even tried clearing the cache and application pool.

Have I done something wrong or is there a bug in this section of the CMS?

Thanks,
Tim

User avatar
Member
Member
tspring-allegra - 11/29/2012 4:06:19 AM
   
RE:Custom Form Control: File attribute type
Has anyone found a fix for this? I'm still having the same problem.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 12/3/2012 3:02:21 AM
   
RE:Custom Form Control: File attribute type
Hi,

What are the exact settings of your form control in the Form controls section?
I just created a simple control, registered it in Site Manager and it is working just fine.

What are the exact steps to reproduce the issue? I have added the custom form control for a document type, saved it, navigated to some other part of the UI and then got back - the settings are still there as I saved them.

Best regards,
Juraj Ondrus

User avatar
Member
Member
tspring-allegra - 12/3/2012 4:55:16 AM
   
RE:Custom Form Control: File attribute type
These are the setting I have in the Form Controls section: User image

This is the export of my form control: Download Form Control

I get the problem when I add the control to a field in a form, like below:
User image

It saves the field as the correct control. But if I exit the form setup, then go back in to edit it and the field list. The field selection type switches to Text, like this:

User image

Just to be clear, it only displays the field as a Text type, it hasn't actually changed the field to Text in the database. Unless obviously I click save from the last screenshot.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 12/3/2012 6:16:03 AM
   
RE:Custom Form Control: File attribute type
Hi,

Thank you for the details. I was able to reproduce this issue. Thank you for letting us know about this. Regrettably, this seems to be a bug in the current version (v7 as well). I'm very sorry for this inconvenience. We will try fix it in the the next hotfix package for Kentico CMS v7.

Best regards,
Juraj Ondrus