I am trying to access the upload button of an Image field. The field itself is in a field collection. Using dpm, I can access the field collection, and the image field.
What I want is to create a callback for the upload button such that once the upload is complete, the callback is triggered (ultimately to call a js function). I have found a few articles on how to do this for custom made, from scratch forms, but very little, and nothing yet that seems to work for me on existing, core forms.
I have been racking my brain for a couple of hours looking through elements via dpm, and researching, but I haven't found any fruitful examples related to this particular use-case.
I also tried tinkering with hook_field_widget_form_alter, which triggers for each element on every load, including initial load. I haven't been able to narrow it down to just the one event yet.
I went a completely different way as well, trying to intercept the click on the input via jQuery, which would then use a timer to check for the uploaded file in the new DOM output, and continue if found, but I cant get the click to work - I don't know if the built in ajax is over-ruling my code, or just a big conflict is causing it to fail for my own code.
Does anyone have any suggestions or direction on where I should look next?