我有以下 Flux 模板:

<f:section name="Configuration">
  <flux:form id="galleria" enabled="TRUE" label="Galleria image & video plugin">
    <flux:form.sheet name="data" label="Images / Videos">
        <flux:form.section name="settings.items" label="Items" inherit="0">
            <flux:form.object name="item" label="Gallery item" inherit="0">
                <flux:field.select name="type" label="Type"
                                            items="{0: 'Please select', 1: 'Image', 2: 'Video', 3: 'IFrame', 4: 'Flickr', 5: 'Picasa', 6: 'Folder', 7: 'File Collection'}"
                                            default="0"
                                            requestUpdate="TRUE"/>
<f:debug>{type}</f:debug>
                <f:comment>Image configuration fields</f:comment>
                <flux:field.file name="original" label="Main image" displayCond="FIELD:type:=:1"
                                          required="TRUE"/>
            </flux:form.object>
        </flux:form.section>
    </flux:form.sheet>
 </flux:form>
</f:section>

displayCond 不起作用。即使我从名为 type 的选择列表中选择图像,输入字段也从未显示过。
调试语句的输出显示“NULL”

如何将 displayCond 与 Flux:form.object 内的字段一起使用?

最佳答案

您正在使用 requestUpdate="TRUE" 。这很好,因此您可以使用以下内容:

<f:if condition="{type}==1">
 <flux:field.file .... />
</f:if>

<f:if condition="{type}==2">
 [...]
</f:if>
<f:if> 不仅适用于预览或主要部分。您也可以在配置部分中使用它。

关于类型 3:Flux 和 DisplayCond,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38061725/

10-11 17:45