Need to block user input in pathbrowser | Community
Skip to main content
Level 2
Dec 12, 2016 10:42 AM UTC

Need to block user input in pathbrowser

Hi,

In my dialog I have put a pathbrowser field (granite/ui/components/foundation/form/pathbrowser). But I want to block the user from manually entering the path in the field and only choosing the path via the path finder. Is there some property that can be used for this ?

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

5 replies

Nupur_Jain
Employee
Dec 13, 2016 8:20 AM UTC

Hey Ankush,

I once encountered the same scenario where I didn't want author to enter any input , only allowing him to select the path, I created the javascript for that which I included in "cq.authoring.dialog" clientlib category.

Here is the javascript code sample that can help you :

$(document).on("dialog-ready", function() {    var pathReadonly = function() {        setTimeout(function() {            $(".path-readonly").find(".js-coral-pathbrowser-input").each(function() {                $(this).attr("readonly", "readonly");            });        }, 250);    }    pathReadonly();
});

Add the property "class" with value "path-readonly"  to the dialog node of resourceType ''granite/ui/components/foundation/form/pathbrowser"  and it should work.

Hope this helps!

 

Thanks,

Nupur

Translate
New Participant
Nov 22, 2017 6:38 AM UTC

Hi Nupur,

I tried the above approach and getting the below console error, and after this, i am not able to access the authoring dialog. ( even close the dialog or enter any filed values ) can you please help ?

Uncaught TypeError: Cannot read property 'unifySpacing' of undefined

    at transformTo (http://localhost:4502/libs/cq/gui/components/authoring/editors/clientlibs/core.js:20430:29)

    at Object.<anonymous> (http://localhost:4502/libs/cq/gui/components/authoring/editors/clientlibs/core.js:20516:21)

    at Object.<anonymous> (http://localhost:4502/etc.clientlibs/clientlibs/granite/jquery.js:3411:33)

    at fire (http://localhost:4502/etc.clientlibs/clientlibs/granite/jquery.js:3232:31)

    at Object.fireWith [as resolveWith] (http://localhost:4502/etc.clientlibs/clientlibs/granite/jquery.js:3362:7)

    at Object.<anonymous> (http://localhost:4502/etc.clientlibs/clientlibs/granite/jquery.js:3418:41)

    at fire (http://localhost:4502/etc.clientlibs/clientlibs/granite/jquery.js:3232:31)

    at Object.fireWith [as resolveWith] (http://localhost:4502/etc.clientlibs/clientlibs/granite/jquery.js:3362:7)

    at Object.deferred.(anonymous function) [as resolve] (http://localhost:4502/etc.clientlibs/clientlibs/granite/jquery.js:3461:36)

    at HTMLScriptElement.<anonymous> (http://localhost:4502/etc.clientlibs/granite/ui/components/coral/foundation/clientlibs/foundation.js:827:26)

Translate
smacdonald2008
Level 10
Dec 12, 2016 3:57 PM UTC

Here is the doc for this Granite Type: 

https://docs.adobe.com/docs/es/aem/6-1/develop/extending/granite/granite-reference.html#Form Inputs - Pathbrowser

I am not aware of it supporting this functionality - that is blocking a user from selecting a path. After all - this is the purpose of this widget.

Translate
Level 2
Dec 13, 2016 2:53 AM UTC

I want to select the path only through the path finder by browsing through the node structure in the repository like /content/geometrixx, I don't want the user to enter the path manually by typing the path (e.g. https://www.google.com).

Translate
smacdonald2008
Level 10
Dec 13, 2016 5:27 PM UTC

Ok - i was not 100% clear in that - you want them to only be able to select the path - not paste it into the control. You need to extend that - see the code posted by nupurj17891248.

Translate