Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ken Dimmer 13 posts 72 karma points
    Aug 10, 2015 @ 15:36
    Ken Dimmer
    1

    Datepicker not populating correctly Umbraco 7.2.8

    I ran into this in a project upgraded from 7.1.x to 7.2.8. The problem is due to some Umbraco changes to their stock DatePicker that break the way DTG was using them. I believe this commit is the one that introduced the issue (https://github.com/umbraco/Umbraco-CMS/commit/43f99e11a5736c25fdc0f3aa89a4fc5169fe8dfa), but several others are at play too.

    In this commit, they essentially introduced a "render model" and use that to store the "live" picked value, then when the page is saved (via formSubmitting event), they assign that value to $scope.model.value, which is what DTG is reading. The problem is that DTG also relies on the formSubmitting event, but DTG's is firing first, before the DatePicker has had a chance to assign to $scope.model.value, thus it sees an empty value. Even though you see the picked value in the textbox at first, DTG never actually knows about it since it's not on $scope.model.value yet. This worked before because the datepicker was bound directly to $scope.model.value.

    Unfortunately there is no way to control the order of formSubmitting events, and in general it's not a reliable way to handle nested properties.

    That being said, here is one hacky workaround that does fix the issue — But, I don't know what other problems it might introduce without spending some more time on this, so you'll definitely want to test. This is more to prove the issue and not meant to be a production fix.

    The hack: /umbraco/Js/umbraco.controllers.js After line 4849, add: $scope.model.value = $scope.datetimePickerValue;

    Some ideas for a proper fix:

    • Update DTG to force formSubmitting events, similar to Archetype
    • Update DTG to read the DatePicker value differently, maybe by
      accessing the render model instead or querying the textbox directly
  • David Dimmer 76 posts 134 karma points
    Aug 11, 2015 @ 00:37
  • David Dimmer 76 posts 134 karma points
    Aug 12, 2015 @ 00:27
    David Dimmer
    0

    Our hack:

    The hack: /umbraco/Js/umbraco.controllers.js

    After line 4849, add:

    $scope.model.value = $scope.datetimePickerValue;

  • Osman Coskun 170 posts 404 karma points
    Nov 10, 2015 @ 12:37
    Osman Coskun
    0

    It worked for me. Thank you very much.

    I just need to increment clientDependency version in file config\ClientDependency.config

Please Sign in or register to post replies

Write your reply to:

Draft