Drupal.ajax.prototype.beforeSubmit - a lesser-known bit of usefulness
The problem
So you have a Drupal 7 AJAX form (this not tested on D8 yet) with more than one submit button. For whatever reason, you want to override one of the field values if a certain submit button is clicked. You can't easily add a click event handler to the submit button because Drupal AJAX does its own thing.