Adobe AEM-如果在不同的文本字段对话框中输入相同的值,则显示错误

Adobe AEM-如果在不同的文本字段对话框中输入相同的值,则显示错误,adobe,aem,Adobe,Aem,我在同一页上有4个相同的组件。组件将idAttribute作为可编写字段。页面上的所有组件都应具有不同的编写值。如果输入的编写值当前正在另一个组件中使用,是否有方法显示错误。 下面的代码不起作用 let-id属性; $(文档)。打开(“对话框准备就绪”,函数(e){ 如果( $(“.cq对话框”).find(“.layout组件编写字段”).length>0 ) { 让$dialogForm=$(“.layout组件编写字段”) .parents(“.cq对话框”) .查找(“表格.基础表格”)

我在同一页上有4个相同的组件。组件将
idAttribute
作为可编写字段。页面上的所有组件都应具有不同的编写值。如果输入的编写值当前正在另一个组件中使用,是否有方法显示错误。 下面的代码不起作用

let-id属性;
$(文档)。打开(“对话框准备就绪”,函数(e){
如果(
$(“.cq对话框”).find(“.layout组件编写字段”).length>0
) {
让$dialogForm=$(“.layout组件编写字段”)
.parents(“.cq对话框”)
.查找(“表格.基础表格”);
让authoredInput=$dialogForm
.find(“[name=”./layoutIdAttribute']”)
.val();
if(authoredInput!=“”&&authoredInput!=null){
idAttribute=authoredInput;
}
}
});
$(文档).on(“单击”、“.cq对话框提交”,函数(e){
如果(
$(“.cq对话框”).find(“.layout组件编写字段”).length>0
) {
e、 停止传播();
e、 预防默认值();
让$form=$(this.closest(“form.foundationform”);
让idInput=$form.find(“[name=”./layoutIdAttribute']”)。val();
//检查此页上的id是否唯一
设idIsUnique=函数(id){
if(idAttribute==未定义的| | id!==idAttribute){
返回(
$(“iframe#ContentFrame”)
.contents()
.find(“[id=“+id+”])。长度===0
);
}else if(id==idAttribute){
返回(
$(“iframe#ContentFrame”)
.contents()
.find(“[id=“+id+”])。长度===1
);
}
};
if(idInput!==“”&&!idIsUnique(idInput)){
ns.ui.helpers.prompt({
标题:Granite.I18n.get(“无效输入”),
信息:
“请输入唯一的ID。ID:(”+
伊迪普特+
“”已在使用中。“,
行动:[
{
id:“取消”,
文本:“取消”,
类名:“珊瑚按钮”,
},
],
});
}否则{
$form.submit();
}
}
});