Home Forums Add-ons Gallery Field Gallery Field options per image Reply To: Gallery Field options per image

  • Hi John,
    You’re perfectly right, I should not care much about the order in the repeater dropdown. In the end, the most important thing is to get the good number of dropdown options, and I’ll be able to achieve this thanks to the actual fired events. So it’s fine.

    I was also thinking to another way to trigger my javascript:
    Rather than looking for gallery events, I could look for the events when using the repeater field.
    Obviously, when I’m clicking on the repeater field, this means I’m not “actually” doing anything on the gallery field. So this would allow me to make sure that at this moment, the gallery filed has a given state and order.
    I’ve made so tests, and for now I’m able to get events fired on the following cases:

    │Image Size                                                           │
    │                                                                     │
    │                    ┌───────────────────────┐       ┌─────────┐      │
    │   Image reference: │IMG_8452             ▼ │  Size:│3        │      │
    │                    └───────────────────────┘       └─────────┘      │
    │                                                                     │
    │                                                       ┌───────────┐ │
    │                                                       │ Add Size  │ │
    │                                                       └───────────┘ │

    • Event fires when changing the “Size” field.
    • Event fires when changing the order of “Image Size” field (when multiple have been added).
    • Event DO NOT fires when changing the “Image reference” field.
    • Event DO NOT fires when clicking the “Add Size” button.

    Being able to capture an event when clicking the “Add Size” button would be by far the best solution. I could instantly trigger my script, get the images of the gallery field, create the dropdown <options> and add them to any number “Image Size” I could find. Probably easy.
    But I’ve not found yet how to capture this button event.