在AEM中,我拦截组件的cq:dialog提交,因为我需要修改一些参数,然后才能将它们发送到默认的POST.jsp
下面的代码适用于组件!!jcr_root/apps/gare_rfi/clientlibsAuthor/js/dialogSubmit_editorialGare.js
(function(document, $, ns) {
"use strict";
$(document).on("click", ".cq-dialog-submit", function(e) {
var $form = $(this).closest("form.foundation-form");
$form.find("[name='./tipologia']").val("this_works");
var tipologia = $form.find("[name='./tipologia']").val();
console.log(tipologia);
});
})(document, Granite.$, Granite.author);问题是,我需要获得组件所在的页面的属性,以及该页面的父页面的属性。
上面的JS文件包含在cq:content.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Editorial Gare"
sling:resourceType="cq/gui/components/authoring/dialog"
extraClientlibs="[gare_rfi.editorialGareAuthor]">
..........换句话说,我希望有一个正确的表达方式来做以下工作:
console.log( this.getPage().getParent().getProperty("jcr:title") );ps。我不想使用ajax。谢谢
pps。http://blogs.adobe.com/experiencedelivers/experience-management/htl-javascript-use-api/,它起作用了!use(函数() { var title = currentPage.properties.get("jcr:title");"use“是什么意思?无论如何,我不能将“使用函数”与我的extraClientlib合并
发布于 2019-07-24 15:18:44
客户端在浏览器上运行。您试图使用的AEM/JCR在当前上下文中是不可用的。所有这些都只能在服务器上运行。不幸的是,您可能不得不使用ajax,我读取PS或编写过滤器。
https://stackoverflow.com/questions/57183872
复制相似问题