autosubmit form

// upload complete event 
Drupal.behaviors.fileUpload = {  
  attach: function(context, settings) {
    jQuery("body").ajaxComplete(function(event,request, settings){
      if (form_build_id = settings.url.match(/file\/ajax\/uploadcoupon\d*\/(.*)$/)) {
        if(jQuery('[value="'+form_build_id[1]+'"]').closest('form').find('[id$=remove-button]').length) {
          jQuery('[value="'+form_build_id[1]+'"]').closest('form').find('[id^=edit-submit]').click();  //trigger form submit
        }
      }
    })
  }
}
Help Share this Article