How to restrict specific asset folder path in pathfield and disable the dates that are previous to current date in date picker? | Community
Skip to main content
Level 2
January 21, 2026
Question

How to restrict specific asset folder path in pathfield and disable the dates that are previous to current date in date picker?

  • January 21, 2026
  • 4 replies
  • 70 views

Hi,

We have requirement to restrict the specific asset folder path while search in pathfield. Since there’s no ootb property to restrict the path. Is there any other way where we can do it? 
Also I need to disable the dates previous to currentdate. How to set that? How to dynamically set min date so that we can disable the previous dates.

Thank you.

4 replies

Jineet_Vora
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
January 21, 2026

@khn - I believe there are two requirements here:

  1. Restrict asset folder path in pathfield
  2. Disable date picker to go in past from today

Restrict asset folder path in pathfield: There is no property to restrict but there is a property called ‘rootPath’ to add a root path so other paths will be restricted. If this is doesn’t work then you can add custom JS validations in the pathfield to give an error if author selects paths from a restricted folder and the dialog wouldn’t get saved.

Read here for pathfield documentation and validation - https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/pathfield/index.html

 

Disable date picker to go in past from today: You can simply use property minDate as today and the datepicker will not allow to go in past. One drawback here is on selecting the date from datepicker, you can still select a date in past if you edit in the input field. Again, to restrict this you can add custom JS. See this thread/solution 

 

Level 2
January 22, 2026

Hi ​@khn 

To restrict a specific asset folder path while searching in the path field, you can implement a custom solution since there is no out-of-the-box (OOTB) property available for this purpose. Here are two approaches you can consider:

  1. Custom Search Predicate: You can create a custom search predicate that limits the search results to a specific folder path. This involves modifying the search form to include a path filter that points to the desired folder. You can set this up in the search interface by adding a filter that specifies the folder path you want to restrict.

  2. Using QueryBuilder: If you have access to the QueryBuilder API, you can construct a query that includes the path restriction. This allows you to programmatically define the folder path that should be included in the search results.

For disabling dates prior to the current date in the date picker, you can dynamically set the minimum date as follows:

  1. Set Minimum Date: In the date picker configuration, you can set the minimum date to the current date. This can typically be done by using a JavaScript function that retrieves the current date and sets it as the minimum value for the date field.

  2. Dynamic Date Setting: If you are using a custom form, you can implement a script that runs on page load to set the minimum date dynamically. This ensures that users cannot select any date prior to today.

Best Regards,

Jyothirmai A

SreenivasBr
Level 4
January 22, 2026

Use rootPath to let the user pick only under a specific path. Refer - https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/pathfield/index.html

If certain folder needs to be hidden, you will need to apply permissions for the users so that the user do not see them.

For datepicker, try setting minDate=today

PGURUKRISHNA
Level 4
January 23, 2026

Hi ​@khn 

1. Restrict Asset Folder Path in Pathfield

In your dialog XML (.content.xml):

<assetPath
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
fieldLabel="Asset Path"
name="./assetPath"
rootPath="/content/dam/wknd"/>

 

Replace 

/content/dam/wknd

 with your specific allowed folder path.

2. Disable Past Dates in Datepicker

Step 1: Create clientlib folder structure:

/apps/wknd/clientlibs/clientlib-authoring/
├── .content.xml
├── js.txt
└── js/
└── datepicker-min-date.js

 

Step 2: Create 

.content.xml

:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
categories="[cq.authoring.dialog]"/>

 

Step 3: Create 

js.txt

:

#base=js
datepicker-min-date.js

 

Step 4: Create 

js/datepicker-min-date.js

:

(function($, $document) {
"use strict";

$document.on("dialog-ready", function() {
var today = new Date().toISOString().split('T')[0];
$("coral-datepicker").each(function() {
this.min = today;
});
});

})(Granite.$, $(document));

 

Step 5: In your dialog XML:

<startDate
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/datepicker"
fieldLabel="Start Date"
name="./startDate"
type="date"/>

 

Step 6: Rebuild and deploy your project.

 

  • Pathfield: Restricted to specific folder using 

    rootPath
  • Datepicker: Past dates disabled using clientlib JavaScript