AEM ::下拉选择值和复选框未保存

时间:2015-03-26 21:32:50

标签: cq5 aem

我在页面属性中添加了一个新标签。该选项卡由一个multifieldpanel(acs-aem-commons bundle)组成。我正在尝试添加文本字段,下拉列表和一些复选框。问题是,当我选择下拉列表中的值并选中复选框时,一切看起来都很好但是当我再次打开页面属性时,它看起来并不像值已保存。这是代码:

<tab_xxxx_suppression xmlns:social="http://www.adobe.com/social/1.0" jcr:primaryType="cq:Panel" title="Suppression">
<items jcr:primaryType="cq:WidgetCollection">
<idsuppress jcr:primaryType="cq:Widget" fieldDescription="Press + to add more" fieldLabel="Configure ID card suppress" name="./idsuppress" width="1000" xtype="multifield">
<fieldConfig jcr:primaryType="cq:Widget" name="./fieldConfig" xtype="multifieldpanel">
<items jcr:primaryType="cq:WidgetCollection">
<providedValue jcr:primaryType="cq:Widget" allowBlank="false" fieldDescription="Please provide the value for option selected above" fieldLabel="Provide value here" key="providedValue" labelStyle="width:150px" name="./providedValue" xtype="textfield"/>
<selectList jcr:primaryType="cq:Widget" defaultValue="0" fieldLabel="Business Rules" name="./suppress" type="select" xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<one jcr:primaryType="nt:unstructured" text="Vanity URL" value="Vanity"/>
<two jcr:primaryType="nt:unstructured" text="PV/RC" value="PVRC"/>
<three jcr:primaryType="nt:unstructured" text="SA/OI" value="SAOI"/>
<four jcr:primaryType="nt:unstructured" text="Market Type" value="Market"/>
<five jcr:primaryType="nt:unstructured" text="Product Code" value="Product"/>
<six jcr:primaryType="nt:unstructured" text="Div Code" value="Div"/>
<seven jcr:primaryType="nt:unstructured" text="State of Issue" value="State"/>
<eight jcr:primaryType="nt:unstructured" text="Government Program Code" value="Government"/>
</options>
</selectList>
<suppressOptions jcr:primaryType="cq:Widget" title="Selection Options" xtype="dialogfieldset">
<items jcr:primaryType="cq:WidgetCollection">
<whole jcr:primaryType="cq:Widget" fieldLabel="Suppress View ID Card Functionality" labelStyle="width:240px" name="./whole" type="checkbox" width="auto" xtype="selection"/>
<order jcr:primaryType="cq:Widget" fieldLabel="Suppress Order ID card Functionality" labelStyle="width:239px" name="./order" type="checkbox" width="auto" xtype="selection"/>
<view jcr:primaryType="cq:Widget" fieldLabel="Suppress View ID Card Functionality" labelStyle="width:238px" name="./view" type="checkbox" width="auto" xtype="selection"/>
</items>
</suppressOptions>
</items>
</fieldConfig>
</idsuppress>
</items>
</tab_xxxx_suppression>

1 个答案:

答案 0 :(得分:0)

我在环境中尝试你的代码,我认为我发现了问题(或问题):

  1. 由于您将属性定义为多字段,因此将其存储为json对象。因此,每个项目的属性都是json键(没有属性本身),您需要指定“key”属性而不是“name”。
  2. 我不知道为什么fieldConfig不喜欢dialogfieldset,导致复选框的出现。
  3. 最后,下面的代码对我来说很好:

            <idsuppress jcr:primaryType="cq:Widget" fieldDescription="Press + to add more"
            fieldLabel="Configure ID card suppress" name="./idsuppress" width="1000"
            xtype="multifield">
            <fieldConfig jcr:primaryType="cq:Widget" xtype="multifieldpanel">
                <items jcr:primaryType="cq:WidgetCollection">
                    <providedValue jcr:primaryType="cq:Widget"
                        allowBlank="false" fieldDescription="Please provide the value for option selected above"
                        fieldLabel="Provide value here" key="providedValue" labelStyle="width:150px"
                        name="./providedValue" xtype="textfield" />
                    <selectList jcr:primaryType="cq:Widget" defaultValue="0"
                        fieldLabel="Business Rules" key="suppress" type="select" xtype="selection">
                        <options jcr:primaryType="cq:WidgetCollection">
                            <one jcr:primaryType="nt:unstructured" text="Vanity URL"
                                value="Vanity" />
                            <two jcr:primaryType="nt:unstructured" text="PV/RC" value="PVRC" />
                            <three jcr:primaryType="nt:unstructured" text="SA/OI"
                                value="SAOI" />
                            <four jcr:primaryType="nt:unstructured" text="Market Type"
                                value="Market" />
                            <five jcr:primaryType="nt:unstructured" text="Product Code"
                                value="Product" />
                            <six jcr:primaryType="nt:unstructured" text="Div Code" value="Div" />
                            <seven jcr:primaryType="nt:unstructured" text="State of Issue"
                                value="State" />
                            <eight jcr:primaryType="nt:unstructured" text="Government Program Code"
                                value="Government" />
                        </options>
                    </selectList>
    
                    <whole jcr:primaryType="cq:Widget"
                        fieldLabel="Suppress View ID Card Functionality" labelStyle="width:240px"
                        key="whole" type="checkbox" width="auto" xtype="selection" />
                    <order jcr:primaryType="cq:Widget"
                        fieldLabel="Suppress Order ID card Functionality" labelStyle="width:239px"
                        key="order" type="checkbox" width="auto" xtype="selection" />
                    <view jcr:primaryType="cq:Widget" fieldLabel="Suppress View ID Card Functionality"
                        labelStyle="width:238px" key="view" type="checkbox" width="auto"
                        xtype="selection" />
    
                </items>
            </fieldConfig>
        </idsuppress>
    

    希望这对你有所帮助!