Validate selected path in Page Selector

James Mosquito asked on March 9, 2021 13:32

Hi is it possible to validate the path of the selected page in the Page Selector field?

I tried something along these lines (which sadly does not work): Satisifies macro condition EditedObject.NodeAliasPath.StartsWith("/My/Path/")==true

Thanks, James

Recent Answers

Dmitry Bastron answered on March 9, 2021 14:43

Hi James,

Could you please give a bit more context on what are you trying to achieve as well as the version of CMS you are using?

From what you are asking, I can guess you have a custom page type, with Page Selector field and you want to check whether the selected path passes the validation, is this correct?

0 votesVote for this answer Mark as a Correct answer

James Mosquito answered on March 11, 2021 15:43

Hi Dmitry

Version: 12 SP

For context: I have a Page selector form control to allow the editor to select a custom page type from a specific path within the content tree. Some googling suggested that you cannot specify a start node for the Page Selector. As a compromise I was considering validating the field after a page is selected to check that the NodeAliasPath begins with the path where the custom page types reside.

This field has already been in use by the content editors, so I am reluctant to swap it out for a different form control.

It's not essential, but just for my own curiosity it would be nice to know if the validation rule can be done.

And to confirm, yes your summarised assumption is correct.

Thanks, James

0 votesVote for this answer Mark as a Correct answer

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