Copied to clipboard

Flag this post as spam?

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


  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Jul 22, 2014 @ 12:39
    Warren Buckley
    0

    V7 package.manifest validation array

    Hello all
    I am working on a new property editor for Umbraco 7, I noticed there is a validation object in the package.manifest

    http://umbraco.github.io/Belle/#/tutorials/manifest

    What values can this be set to please, and is it only for the main editor or can it be applied to the prevalue editors/views?

    As I would ideally like to make one of my prevalues on my property editor (data type) a required field, otherwise the property editor is not valid & cannot be saved.

    I look forward to hearing back & learning more.

    Thanks,
    Warren :)

  • Allan Molsen Larsen 22 posts 192 karma points
    Jul 22, 2014 @ 14:25
    Allan Molsen Larsen
    1

    Hi Warren

    Do you mean somethink like:

    http://www.nibble.be/?p=377

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Jul 23, 2014 @ 12:22
    Warren Buckley
    0

    Yes thanks that did help and was what I was after for now.

    "prevalues": {
        "fields": [
          {
            "description": "Enter the unique Channel ID to display videos only for that channel",
            "key": "channelId",
            "label": "Channel ID",
            "view": "textstring",
            "validation": [
              {
                "type": "Required"
              }
            ]
          }
        ]
      }
    

    I have seen this example of multiple validation type's, however I am curious to know what other types & values this validation object can be

    validation: [
    {
        type: "Delimited",
        config: {
            delimiter: ",",
            pattern: "^[a-zA-Z]*$"
        }
    }]
    

    And this other one I found as well:

    validation: [
    {
        type: "Required" 
    },
    {
        type: "Regex",
        config: "\\d*"
    }]
    
  • Shannon Deminick 1530 posts 5278 karma points MVP 3x
    Jul 23, 2014 @ 19:17
    Shannon Deminick
    100

    Manifest declared validators are for server-side validation without you having to write any c#, if you require more complex server side validation then you will need to write a c# property editor.

    Manifest validators are implementations of:

    https://github.com/umbraco/Umbraco-CMS/blob/7.1.5/src/Umbraco.Core/PropertyEditors/ManifestValueValidator.cs

    Here's all of the current implementations:

    Remember - client side validation is not enough; if you absolutely require your values to be validated, then you need to use server side, otherwise malicious people could send whatever data they want to store in your property.

    Feel free to update our documentation with this information if you like :)

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Jul 24, 2014 @ 18:20
    Warren Buckley
    0

    Hey Shannon,
    Thanks for letting me know about this and what ones are available to us package developers to use out of the box with Umbraco.

    Yes I would like to document this, just need to find the time to do it & find out how the Belle docs work etc...

    Is it possible to write my own custom ManifestValueValidator for my own package that I am writing? I want to ensue the JSON data it saves as a prevalue (YouTube Username, YouTube Weird Channel GUID, YouTube Channel Logo) exists & has values & I presume the rewuired one that Umbraco ships with will just check a simple string, rather than a JSON object that I will save back to Umbraco as a PreValue?

    Thanks,
    Warren

  • Shannon Deminick 1530 posts 5278 karma points MVP 3x
    Jul 24, 2014 @ 18:23
    Shannon Deminick
    0

    Don't worry about documenting with the Belle docs - these will ONLY be used for API docs eventually which are auto generated. Everything else goes into the normal Our docs and everything apart from the API docs will be removed from the Belle docs.

    No, you cannot create custom manifest value validators. If you need more control over all of the data that is saved for your property editor, you will need to create a c# property editor. You can do whatever you like with a c# property editor including custom validation, control exactly what data is stored, etc...

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Jul 24, 2014 @ 18:38
    Warren Buckley
    0

    OK I will add them into the normal Our docs about the package.manifest and these out of the box validators for the editors or prevalue editors.

    I don't want to validate the main property editor with this method, but a prevalue editor instead & I was hoping I could create a custom one of these classes to use with my prevalue.

    Cheers,
    Warren

  • Shannon Deminick 1530 posts 5278 karma points MVP 3x
    Jul 24, 2014 @ 18:41
    Shannon Deminick
    0

    Doesn't matter if it is a pre-value editor or the main property editor - they are both part a 'Property Editor' construct in c#. It is extremely easy to make a c# property editor - it would be basically the same amount of code to create a custom manifest validator in c# as to create a custom property editor in c#. There's plenty of examples in the core.

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Jul 24, 2014 @ 18:43
    Warren Buckley
    0

    OK can you point me in the right direction about C# property editors/prevalue editors please, as I still find the core source base a BIG and scary base and not knowing where to look is half the battle I normally have.

    Thanks,
    Warren :)

  • Shannon Deminick 1530 posts 5278 karma points MVP 3x
    Jul 24, 2014 @ 18:47
  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Jul 24, 2014 @ 18:55
    Warren Buckley
    0

    Thanks your a legend!

  • Ivan 165 posts 543 karma points
    Dec 14, 2016 @ 16:13
    Ivan
    0

    Hello,

    The url above doesn't seem to work any longer:

    https://github.com/umbraco/Umbraco-CMS/tree/7.1.5/src/Umbraco.Web/PropertyEditors

    Is there another the "C# Property Editor" guides our there?

  • Shannon Deminick 1530 posts 5278 karma points MVP 3x
    Dec 14, 2016 @ 23:05
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies