1

在阅读有关文档的这篇(和其他......)文章(链接)后,我找不到我身边的问题......

我不能让触发事件工作......所以这是我的代码:

//fields.yaml

fields:
    gallery:
        label: Galeria
        span: full
        oc.commentPosition: ''
        prompt: 'Add new item'
        type: repeater
        form:
            fields:
                type:
                    label: 'Select the type of a gallery item'
                    span: full
                    type: galleryplusvideoselect
                galleryplusvideo:
                    label: Gallery
                    span: full
                    oc.commentPosition: ''
                    type: galleryplusvideo
                    hidden: true
                    trigger:
                        action: show
                        field: type
                        condition: value[image]

//图库加视频选择_widget.htm文件

<div data-control="balloon-selector" class="control-balloon-selector">
    <ul>
        <li data-value="image" <?php if($type == "image") echo 'class="active"'; ?>>Image</li>
        <li data-value="video" <?php if($type == "video") echo 'class="active"'; ?>>Video</li>
    </ul>

    <input type="text" onkeyup="
            $(this).trigger('change')" <!-- <--- THIS IS ONLY TO REPRODUCE AN EXAMPLE FROM THE DOCUMENTATION -->
    name="<?=$name ?>" value="<?= $type ?>" />
</div>

图片

我尝试创建一个简单的复选框和文本区域,并在中继器之外创建触发功能......但它不起作用......我找不到任何类型的 JS“激活”,所以我不知道我可以做这个工作......

4

1 回答 1

1

摆脱hidden: true. 触发器action: show属性会自动隐藏您的字段,无需双重隐藏。交叉发布在OctoberCMS 问题存储库中

于 2017-03-11T02:58:15.683 回答