DD0UG
DD0UG

Reputation: 142

Display field on form tab based on current page template

I am trying to hide fields from the form tab in Kentico if the template is not in a category. I have tried the following in visibility condition:

CurrentDocument.DocumentPageTemplate.PageTemplateCategory.DisplayName=="foo"

Upvotes: 1

Views: 280

Answers (2)

Brenden Kehren
Brenden Kehren

Reputation: 6117

When working in the Kentico UI and setting field visibility always use the EditedObject object vs. the CurrentDocument object. The CurrentObject object is only used during runtime of the actual page and never on the form tab. The EditedObject will work with within the form tab of a page type as well as within any Kentico UI pages.

So in your case, replace CurrentDocument with EditedObject to get the correct object.

Upvotes: 2

Dawid Jachnik
Dawid Jachnik

Reputation: 447

Replace the CurrentDocument with EditedObject

EditedObject.DocumentPageTemplate.PageTemplateCategory.CategoryDisplayName="foo"

if the Category eqauls foo it will be visible, otherwise no

Upvotes: 2

Related Questions