Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to filter CQ.form.PathField options according to the template?

Avatar

Level 2

Folks,

I want to use a CQ.form.PathField in a dialog to allow the author to choose a page. However I would like to limit the options to pages that were built using a certain template. The options to filter content based on the path or page name are not applicable. A custom predicate does not seem to work either, since it would discard parent nodes that do not implement my template, but that could potentially have children that do.  

Is the only solution here to extend CQ.form.PathField?

Any thoughts?

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Level 4

There is another article that may be helpful to you: 

https://helpx.adobe.com/experience-manager/using/creating-custom-cq-tree.html

It talks about how to populate a control (could be a control in a dialog) using JS that makes a call to Server-side Java code. On the Java side - you can control what data to display in the control. 

View solution in original post

3 Replies

Avatar

Level 4

You would write a custom xtype that uses a CQ.form.PathField. In that JS code, you can dynamically set the values you want for the PathField instance. You cannot do this by setting nodes and properties. It has to be done via code. See the following article that has script named developers.js. This will point you in the right direction: 

https://helpx.adobe.com/experience-manager/using/jstl.html

In addition - here is the reference docs for this object: 

https://docs.adobe.com/docs/en/cq/5-3/widgets-api/index.html?class=CQ.form.PathField

Hope this helps

Avatar

Level 2

Steve,

Thanks for the reply. I read the article and got the idea. At the end I would have to customize the interaction to the server that fetches the tree nodes. 

Avatar

Correct answer by
Level 4

There is another article that may be helpful to you: 

https://helpx.adobe.com/experience-manager/using/creating-custom-cq-tree.html

It talks about how to populate a control (could be a control in a dialog) using JS that makes a call to Server-side Java code. On the Java side - you can control what data to display in the control.