More in this section
Forums / Developing with Sitefinity / Custom field type not saved for dynamic module

Custom field type not saved for dynamic module

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 0 answered
  1. Ollie P
    Ollie P avatar
    9 posts
    06 Jan 2016
    18 Feb 2016
    Link to this post

    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? 

  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    17 Aug 2017
    22 Feb 2016
    Link to this post
    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
  3. K
    K avatar
    1 posts
    25 Feb 2016
    25 Feb 2016
    Link to this post

    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?

3 posts, 0 answered