【发布时间】:2019-07-24 13:15:46
【问题描述】:
在 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:dialog - 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/ 有用! 使用(函数(){ var title = currentPage.properties.get(“jcr:title”); “使用”是什么意思? 无论如何,我无法将“使用功能”与我的 extraClientlib 合并
【问题讨论】:
标签: javascript jquery aem crx