활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
I have create a custom js file in a clientlib with category dam.gui.coral.metadataeditor. I have added the below code to my JS:
"use strict";
use(function () {
var path = currentPage.path;
});
When I open the Properties page for my asset this JS loads. But I am seeing a console error:
Uncaught ReferenceError: Use is not defined at <myjsfile.js:2>
I am not able to use the Use Api in my javascript
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
currentPage is a server side object which can be only used in HTL JavaScript Use-API, Rhino JavaScript engine will convert JavaScript and only understands HTL global objects. You can not use HTL global object in custom Client Library JavaScript.
Did you try restarting this instance? I see other people are facing this issue. check below link
조회 수
답글
좋아요 수
The js use API execute at the server-side and we use this in components business logic, but I never tried this by adding category dam.gui.coral.metadataeditor, and in this case, based on my understanding you are calling use API in metadata validation, I think this will not work. you need to use JS to get the page path and other business logic.
This is my understanding let's hear from other community members
조회 수
답글
좋아요 수
You need to use jquery selectors to get the value, check this article to get some idea https://medium.com/@theopendle/aem-custom-metadata-forms-for-assets-8c6597205f9d
조회 수
답글
좋아요 수
currentPage is a server side object which can be only used in HTL JavaScript Use-API, Rhino JavaScript engine will convert JavaScript and only understands HTL global objects. You can not use HTL global object in custom Client Library JavaScript.
조회 수
답글
좋아요 수