gpt4 book ai didi

extjs - 在 cq5 对话框的提交事件之前使用

转载 作者:行者123 更新时间:2023-12-01 11:21:45 25 4
gpt4 key购买 nike

我需要验证用户在 CQ5 对话框中提供的输入(页面组件的 - 在侧踢中单击页面属性时打开)。某些字段没有 vtype 属性。我计划在对话框下的监听器节点中使用对话框的 beforesubmit 事件。由于某种原因,beforesubmit 事件的函数不会被调用。它的行为就像根本没有添加事件一样。我尝试将 afterrender 事件添加到同一个 listeners 节点,并且可以正常工作。下面是我的 dialog.xml 的摘录

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.orgjcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
title=""
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
</items>
<listeners
jcr:primaryType="nt:unstructured"
afterrender="function(dialog){alert(dialog);}"
beforesubmit="function(dialog){alert(dialog);}"/>
</jcr:root>

请帮助我弄清楚如何在按下对话框上的“确定”按钮时调用一个函数,并在验证失败时取消提交。提前致谢。

我指的是以下链接上的代码:

http://www.albertoalmagro.com/2012/12/complex-client-side-dialog-validation-javascript-adobe-cq5.html

最佳答案

这是因为对话框的 xtype 是“ tabpanel ”和 tabpanel doesn't have提交前事件。

将 xtype 更改为“ dialog ”,如果验证失败,则在 beforesubmit 处理程序中返回 false。这将阻止对话框被提交。

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.orgjcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
title="" xtype="dialog">
<items jcr:primaryType="cq:WidgetCollection"></items>
<listeners jcr:primaryType="nt:unstructured"
beforesubmit="function(dialog){
if(<<!valid>>){
return false;
}
}" />
</jcr:root>

关于extjs - 在 cq5 对话框的提交事件之前使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22478787/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com