I'm trying to trigger an javascript function when a user select an image for a managed_file field and click on the upload button, not the submit one.Except that in Drupal 7, managed_filr field do not accept ajax argument, I don't have any idea on how to solve my problem. Thanks you in advance.

1 Answer 1


Finally I found a solution. I decide to use the '#upload_validators' parameter on my form and to declare my own function:

'#upload_validators' => array(
  'myOwnFunction' => array(parameters)

function myOwnFunction(parameters){
do stuff();

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.