Restrict user to select certain page type in Path selector

Novice User asked on March 29, 2018 00:28


I am creating a webpart where I have a path selector. I want user to select only a folder that is of a certain type. I am using validation of the control and In general condition I am writing this code. But its not validating in any of the case. I am using Kentico 10.


Recent Answers

Brenden Kehren answered on March 29, 2018 00:48

If this is in the kentico UI then you need to use the EditedDocument object vs CurrentDocument. Also I believe you can use EditedDocument.ClassName.

1 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on March 29, 2018 07:10 (last edited on December 10, 2019 02:31)

If this is a webpart property on a Path, this is what you'll probably need to do for validation.

First, get the value using {% PropertyName %} in which case, should be "Path"

Next we need to do a lookup on that object, you can do this through the Documents[PathHere], or:

{% Documents[Path].ClassName == "the.Class" |(identity)GlobalAdministrator%}

Try that!

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.