October: Trigger events don't work within repeater

Created on 27 Feb 2017  路  8Comments  路  Source: octobercms/october

After reading this (and others...) article (link) on your 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 from 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...

Review Needed Unconfirmed Bug

Most helpful comment

@dunets I mean the element trigger with action: show will automatically hide.

All 8 comments

I don't think trigger events currently support watching fields within a repeater.

@LukeTowers I recently discovered that it works if I invert it... from action: show but to action: hide and obviously change the condition... within a repeater or not

Interesting, I haven't tested trigger events within a repeater yet, so I'm not sure what's going on. Is your issue resolved then?

@LukeTowers hello... I think yes, because I can create a functionality that I want.. .but it's still need to be fixed :) because for example on documentation for example it's shown that it works...


And one more thing.. it will be great if the documentation will have some tutorials... because sometimes it's very hard to find a solution to our problems only by searching the info... and on my case for example it's hard to do something because I just don't know that some functionality exists... summing up, real usage examples/tutorials are missing....
See this guy, he is creating tutorials of octoberCMS, not the best one that I has seen before... but these ones has helped many people... and not documentation :/ maybe you can cooperate and create best product together? like laravel and laracasts
(chanel's video: https://www.youtube.com/watch?v=sRQp_8Xia3E)

Thanks for your atention

Try to remove this line "hidden: true"

@ran-tw hahah but I want to hide the elements :)

@dunets I mean the element trigger with action: show will automatically hide.

As said before, the trigger system works when all fields are inside the repeater. However, it stop working if some fields in the repeater have trigger actions depending on a field that is outside the repeater.

Will open an issue about that cause it should be an opened issue.

Was this page helpful?
0 / 5 - 0 ratings