on an AJAX call from a widget sitting on a special registration URL profile2 page, the URL isn't of the form user/register/phname but system/ajax This makes the $form array not contain what you'd expect for a regularly loaded form and the $form_state['triggering_element'] won't get you a pointer back to an entry in $form because of it.
The basic chain of events is that profile2_regpath_form_user_register_form_alter() fires but it can't find any applicable forms because it is using get_profile_type_by_path() which doesn't see the path in it and so returns the $types array as not applicable and so nothing fires the profile2_attach_form() to get the $form set up the same way as you would in the resulting post and whatnot.
I'm guessing that because Drupal is loading most of the form correctly, there has to be some indicator more reliable of the URL context than the one that get_profile_type_by_path() uses.
Comments
Comment #1
IronWorker commentedoops. sorry, this is basically a duplicate of http://drupal.org/node/1117428 but provides information for same.
Comment #2
grasmash commentedThanks for the comments IronWorker. I've made a response to your post in http://drupal.org/node/1117428
closing. duplicate issue.