Custom field type not saved for dynamic module - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Custom field type not saved for dynamic module

  • Custom field type not saved for dynamic module
  • I am using Sitefinity 8.0 and have created a custom field type to use a UK date format. I want to replace the standard date field type used in my dynamic modules.

    I updated a field by going to Settings > Advanced > DynamicModules > Controls > MyType > Views > MyTypeInsertView > Section > MainSection > Fields > MyDateField and changing the FieldType to 'MyProj.Web.UKDateField, MyProj.Web'.

    The dynamic module updates correctly, and the DynamicModulesConfig.config is updated, but as soon as the dynamic module is edited e.g. to add a new field, the config reverts back to the original type 'Telerik.Sitefinity.Web.UI.Fields.DateField, Telerik.Sitefinity'.

    How can ensure my custom field type is retained?  Where is the default type coming from? 

  • Hello Ollie,

    I am afraid that the current implementation is such that whenever a modification is made to the dynamic module, the definitions are regenerated and any customization is lost. Please refer to the below KB article for more details about this:'s-definitions-are-lost-after-updating-module-fields

    This is considered missing implementation and a feature request is logged related to this as noted in the above KB artcile. here is the link to the description of the feature request:

    You can subscribe to receive notifications for the feature request including new comments, votes, status changes by clicking on the "Follow this item" link. If you would like to unsubscribe, you can unfollow the item by removing "Following this item”.

    Unfortunately, there isn't a workaround available at the moment.

    Sabrie Nedzhip
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  • I’ve looked into this and I believe this should be possible by creating a custom/extended datepicker control template (.ascx) and binding via ViewMap (Administration - Settings - Controls –ViewMap)
    HostType: Telerik.Sitefinity.Web.UI.Fields.DateField, Telerik.Sitefinity
    LayoutTemplatePath: <path to ascx>
    As far as I understand this should replace all datepickers on the backend with the custom template. I believe the custom template doesn’t need any special markup but it needs to override JavaScript prototype methods that are responsible for creating the datepicker field.
    The first link below talks about customizing the datepicker field to change the time format from 24 hours to AM/PM. 
    Here’s a piece of JavaScript that does it:
    Telerik.Sitefinity.Web.UI.Fields.DateField.prototype._setDateTimeMode = function (dFormat, tFormat)
    this._datePicker = jQuery("#" + this._datePickerId).datetimepicker(
    dateFormat: dFormat, hourGrid: tFormat, timeFormat: 'hh:mm TT', minuteGrid: 10, beforeShow: this._datePickerOnPopupOpeningDelegate, onClose: this._datePickerOnPopupClosingDelegate, showOn: "focus", ampm: true
    I believe that it should be possible to change the dateFormat field (highlighted in yellow) to force it to render dates in UK format.


    Could you confirm if this is a workable solution?