How to invoke AJAX on Vertical Tabs? My case is simple: When user switches tabs, I want to dynamically fill empty fields in the tab he entered, calculating them from the tab he went from. Like suggesting city by zip code, or address by company name if I have it in database. 

Problem is - I can do it on button click or on field's blur, but I'd prefer it to happen on vertical tab switch. Items with vertical_tabs type simply does not have #ajax property. Is there any neat way around it? 

#states seemed a solution, but it seems they only support static value set, like:

':input[name="foo"]' =&gt; array('value' =&gt; 'bar'),
#states attributes cannot use to invoke AJAX. See drupal_process_states

With your question, i think the solution is write an javascript file and #attached it to the form you need.

You can bind a click event to .vertical-tab-button element (better) or orverride Drupal.verticalTab.prototype.focus function (not recommend).