U4-6826 - New Content Type Editor with an upload field has JS errors

Created by Shannon Deminick 13 Jul 2015, 12:01:20 Updated by Mads Rasmussen 22 Dec 2015, 13:25:48

Subtask of: U4-112

When viewing a content type that has an upload field assigned to a property, JS error occurs:

TypeError: Cannot read property 'fileCount' of undefined at clearFiles (umbraco.controllers.js?cdv=51624844:6201) at initialize (umbraco.controllers.js?cdv=51624844:6211) at new fileUploadController (umbraco.controllers.js?cdv=51624844:6254) at d (angular.min.js?cdv=51624844:28) at Object.instantiate (angular.min.js?cdv=51624844:28) at $get (angular.min.js?cdv=51624844:53) at angular.min.js?cdv=51624844:44 at n (angular.min.js?cdv=51624844:7) at k (angular.min.js?cdv=51624844:44) at e (angular.min.js?cdv=51624844:40)

which happens in the fileUploadController:

function fileUploadController($scope, $element, $compile, imageHelper, fileManager, umbRequestHelper, mediaHelper) {

    /** Clears the file collections when content is saving (if we need to clear) or after saved */
    function clearFiles() {
        //clear the files collection (we don't want to upload any!)
        fileManager.setFiles($scope.model.alias, []);
        //clear the current files
        $scope.files = [];
        if ($scope.propertyForm.fileCount) {
            //this is required to re-validate
            $scope.propertyForm.fileCount.$setViewValue($scope.files.length);
        }
       
    }

Comments

Shannon Deminick 13 Jul 2015, 12:24:01

I can only assume this is because we are rendering property editors in a non content context. I'm confident similar errors will happen with other people's custom property editors. I'm not sure how the new doc type editor is trying to initialize any sort of content model but it's going to have be be exactly the same way as the content editor currently works otherwise we'll end up with JS errors all the time.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.4.0

Due in version: 7.4.0

Sprint:

Story Points:

Cycle: