Using content Fragment in pathfield how to restrict author not select folder | Community
Skip to main content
Level 6
November 17, 2022
Solved

Using content Fragment in pathfield how to restrict author not select folder

  • November 17, 2022
  • 1 reply
  • 1051 views

In the path field/ asset picker I do not want an author to select any folder, only just the content fragment he should select. Can we do something like this?
Example

Author can not select ABC  just this is sample content fragment

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SantoshSai

Hi @ronnie09 ,

There is no such OOTB functionality we have in AEM, though you can customize it by script if author select invalid content fragment.

Steps as follow:

  1. Use resourceType: dam/cfm/components/cfpicker
  2. Set some class to fetch it in script eg below
  3. Implement script which throws error if selects folder.

Hope that helps!

Regards,

Santosh

 

1 reply

SantoshSai
Community Advisor
SantoshSaiCommunity AdvisorAccepted solution
Community Advisor
November 18, 2022

Hi @ronnie09 ,

There is no such OOTB functionality we have in AEM, though you can customize it by script if author select invalid content fragment.

Steps as follow:

  1. Use resourceType: dam/cfm/components/cfpicker
  2. Set some class to fetch it in script eg below
  3. Implement script which throws error if selects folder.

Hope that helps!

Regards,

Santosh

 

Santosh Sai
Ronnie09Author
Level 6
November 18, 2022

@santoshsai 

I tried something similar but i couldn't achieve writing scripts perfectly. Do you have any sample script . Would help alot