Copied to clipboard

Flag this post as spam?

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


  • Hubert Łachecki 5 posts 105 karma points
    Dec 24, 2020 @ 12:45
    Hubert Łachecki
    0

    Preview attribute in custom umb-property-editor directive

    Hi guys, i spot a problem with my custom control on Umbraco 8.9.0 which is defined like this.

    {
      "alias": "node-picker-63",
      "hideLabel": true,
      "view": "contentpicker",
      "editorAlias": "Umbraco.MultiNodeTreePicker",
      "config": {
        "filter": "",
        "maxNumber": 12,
        "minNumber": 1,
        "multiPicker": true,
        "returnType": "Id",
        "showEditButton": false,
        "showPathOnHover": false,
        "startNode": {
          "type": "content",
          "id": null,
          "query": null
        },
        "type": "content"
      }
    }
    

    Problem is that despite using preview attribute set to true, the validation still occurs if i set min element to 1. With Umbraco.MultiUrlPicker that problem does not occur. Preview works as i cannot add any element in this view, but validation too. enter image description here

    <umb-property-editor model="field.control.value" preview="true" ng-if="field.control.value"></umb-property-editor>
    

    MultiNodeTreePicker is defined like this

    {
      "name": "Multi Url Picker",
      "icon": "icon-link",
      "editorAlias": "Umbraco.MultiUrlPicker",
      "view": "multiurlpicker",
      "config": {
        "minNumber": 1,
        "maxNumber": 12,
        "ignoreUserStartNodes": false,
        "hideAnchor": false
      }
    }
    

    There is no problem with save of this control. enter image description here

    I don't know how but my value in my custom control is validated if there is more than one element as for example if i define it with value: {}, the validation will pass. However in the place where this field would be mandatory and not in preview the validation will not occur too.

Please Sign in or register to post replies

Write your reply to:

Draft