Copied to clipboard

Flag this post as spam?

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


  • Robert Ghafoor 33 posts 95 karma points
    Aug 04, 2021 @ 12:32
    Robert Ghafoor
    0

    How to configure color picker validators to work as a macro parameter (package.manifest)

    Im trying to configure a color picker as a macro parameter and can get it to work but its throwing errors in the console about validation "TypeError: can't access property "mandatory", $scope.model.validation is undefined"

    "propertyEditors": [
        {
          "name": "A Name",
          "alias": "SomeAlias",
          "editor": {
            "valueType": "JSON",
            "view": "views/propertyeditors/colorpicker/colorpicker.html"
          },
          "icon": "icon-colorpicker",
          "isParameterEditor": true,
          "defaultConfig": {
            "multiple": false,
            "items": [
              {
                "label": "section--gray",
                "value": "#f7f7f6"
              }
            ]
          }
        }
      ],
    

    I added a regular color picker and debugged the controller this is how validation object look:

    {
      "mandatory": false,
      "mandatoryMessage": null,
      "pattern": null,
      "patternMessage": null
    }
    

    I then added the above to editor validation like this:

    "propertyEditors": [
            {
              "name": "A Name",
              "alias": "SomeAlias",
              "editor": {
                "valueType": "JSON",
                "view": "views/propertyeditors/colorpicker/colorpicker.html",
                "validation": {
                    "mandatory": false,
                    "mandatoryMessage": null,
                    "pattern": null,
                    "patternMessage": null
                }
              },
              "icon": "icon-colorpicker",
              "isParameterEditor": true,
              "defaultConfig": {
                "multiple": false,
                "items": [
                  {
                    "label": "section--gray",
                    "value": "#f7f7f6"
                  }
                ]
              }
            }
          ],
    

    however when i add this the color picker breaks and i get a regular textbox editor. (the color picker controller is never called)

  • Robert Ghafoor 33 posts 95 karma points
    Aug 13, 2021 @ 07:55
    Robert Ghafoor
    0

    I solved this by cloning the picker and modifying the source directly.

Please Sign in or register to post replies

Write your reply to:

Draft