Currently the treatment of the processbar and response to a form submitted by Ajaxsubmit are pretty hard-coded. They can be overridden by re-declaring Drupal.ajaxsubmit.prototype.oncomplete and Drupal.ajaxsubmit.prototype.onsubmit, but this seems kind of hacky.

It would be really good to lay down a lightweight API that will allow developers/themers to hook into these events and specify custom functionality.

Some initial thoughts:

  • Remove hard-coded processbar definition from js and let it be specified by CSS instead
  • Use form_alter/formapi to add additional elements to the $form object which would in turn trigger some custom js functions.
  • Use the Drupal.settings js object for the same purposes. E.g. Drupal.settings.ajaxsubmit could be an object w/config stuff for various form-id's.

I don't have a strong preference here, but I do want to get a way to customize the functionality without fully overriding the behavior calls.