【发布时间】:2016-01-25 17:43:54
【问题描述】:
我需要将编辑器在对话框面板中的textfield 中写入的值添加到<select> 选项中。我已经为对话框组件创建了多字段选项,但不确定如何在 <select> 中获取值。
我正在使用多字段的 JS 小部件,您可以找到它here。我知道多字段 JS 应该返回一个 JSON 选项数组,我该如何实现呢?
这是我的 XML 标记:
<developer
jcr:primaryType="cq:Widget"
title="Data"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<developer
jcr:primaryType="cq:Widget"
fieldDescription="Click the '+' to add a new data"
fieldLabel="Dev Data"
name="./devdata"
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
xtype="devprofile"/>
</developer>
</items>
</developer>
为多字段添加文本字段的 JavaScript
this.developerName = new CQ.Ext.form.TextField({
fieldLabel : "Developer's Name",
allowBlank: true,
width : 400,
listeners : {
change : {
scope : this,
fn : this.updateHidden
},
dialogclose : {
scope : this,
fn : this.updateHidden
}
}
});
this.add(this.developerName);
还有标记:
<c:if test="${not(empty(developerName))}">
<select id="use-names" class="js-example-basic-multiple">
<option>Example</option>
<option>${developerName}</option>
</select>
</c:if>
如果您需要更详细的分享,请告诉我。
【问题讨论】:
标签: javascript json aem