-2

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?

1 Answer 1

0

You can try hook_file_presave() or hook_file_insert() or hook_file_update()

1
  • this did work, but I ended up going a different direction anyways...
    – Geoff
    Jun 15, 2014 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.