OctoberCMS: Trigger events doesn't work

Ad

After reading this (and others...) article (link) on documentation I could not find an issue from my side...

I can't put the trigger event work... So here is my code:

//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]

//galleryplusvideoselect _widget.htm file

<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>

image

I tryed to create a simple checkbox and textarea and create that trigger functionality outside of a repeater... but it isn't works... I could not found any type of JS "activation" so I don't know that I can to do to put this to work...

Ad

Answer

Ad

Get rid of hidden: true. The trigger action: show property will automatically hide your field, there is no need to double hide it. Cross posted in OctoberCMS issue repository

Ad
source: stackoverflow.com
Ad