I have a managed_file form element. I want to trigger an AJAX callback when a user clicks the upload button. But I can't seem to get anything working by attaching the #ajax element to the managed_file element. I know the managed_file element creates an upload button automatically, so I tried to hook into that using hook_form_alter but the button doesn't seem to have been created yet, so I can't attach the AJAX handler.

Any ideas?

1 Answer 1


No, unfortunately, you can't use #ajax because managed_file uses it internally for its own purposes.

  • Is there any way to it's internal ajax?? Dec 22, 2015 at 8:50

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.