2016-01-22 56 views
0

我需要將編輯器將它們從對話框中寫入textfield的值添加到<select>選項中。我爲對話框組件創建了多字段選項,但不知道如何在自己的<select>中獲得值。CQ5嵌套多字段與選擇選項

我使用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> 

請讓我知道,如果你需要更詳細的分享。

回答