Field "Visibility condition" based on a "Multiple categories selector"

Ryan Kilgore asked on October 5, 2020 22:27

Hello again!

I'm currently fleshing out a "Profile" Page Type that will be used to display various biographical information for people. Part of this includes a distinction between "Faculty", "Students", and a few other categories and subcategories. To make the distinction, I'm using the "Multiple categories selector" so an editor can simply check a few boxes depending on whether a profile belongs to a Faculty member, a Student, an Alumni, etc. There are a number of other categories the editor has to select, so seeing the full category tree makes this form control convenient.

However, there are a few fields that will only be useful for certain categories, e.g. an "Office" text field for Faculty but not for Students/Alumni.

Is there a way for me to reference the selected categories of the current page (in the editor) in order to set a visibility condition on some of these more niche fields?

I have a "Multiple categories selector" field with a code name of Person_Category, but so far I've been unsuccessful in getting any data out of it for use in a "Visibility condition".

I've read that these categories are attached to the page itself, so while I can use the categories just fine in transformations to show/hide field data output via {% CurrentDocuemnt.IsInCategories("Faculty") %}, I can't tell if CurrentDocument is usable in the editor for visibility.

Any guidance here would be appreciated, thanks!

Correct Answer

Arjan van Hugten answered on October 6, 2020 12:37

Yes you can use the categories to show/hide fields with the following condition: "EditedObject.IsInCategories("Faculty")".

I have checked the "Depends on another field" on the field with the visibility condition. And checked the "Has depending fields" on the categories selector. But apperently to me it seems that you have to save the page first to have the visibility condition processed correctly.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Ryan Kilgore answered on October 6, 2020 19:50

Thank you! That's exactly what I was looking for. Good to know about saving first, as well.

0 votesVote for this answer Mark as a Correct answer

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