Multiple Field , same ajax callback I created a custom field. The hook_field_widget_form has an submit element with an ajax callback:

  //Add more
  $element['add_zone'] = array(
    '#type' =&gt; 'submit',
    '#name' =&gt; $field_name . '-add_more-' .'name',
    '#value' =&gt; t('+'),
    '#limit_validation_errors' =&gt; array(),
    '#submit' =&gt; array('dms_polygone_add_more_add_one'),
    '#ajax' =&gt; array(
      'callback' =&gt; 'dms_polygone_add_more_callback',
      'wrapper' =&gt; 'zones-fieldset-wrapper-'. $field_name,
    ),
  );


I add 2 fields of my custom field type to a node. Ex: field_polygone (field type: polygone) and field_polygone_2 (field type: polygone). 
When i press the 'add_more' button of my first field_polygone, my callback function 'dms_polygone_add_more_add_one' thinks the trigger element is field_polygone_2. 

Callback function:

function dms_polygone_add_more_callback($form, $form_state) {
  //@todo: $i gebruiken voor veld als er meerdere waardes zijn toegestaan.
  $parents = $form_state['triggering_element']['#parents'];
  return $form[$parents[0]][$parents[1]][$parents[2]]['zones'];
}


$parents[0] is the field_name => When i press 'add_more' , the $parents[0] variable in the callback function should be 'field_polygone', but its field 'field_polygone_2'. 

How can is solve this problem? Why does the callback function think the trigger element is field_polygone_2 instead of field_polygone.
I had a similar issue in Drupal 8. I had one form with multiple entities (not drupal entities) that had an identical subset of fields and each had their own button. My $form_state-&gt;getTriggeringElement() would always show the last of these buttons, no matter which I clicked. My issue was that I was not setting #name on the buttons and they were both defaulting to op (they had the same #name value). Explicitly setting a unique #name for each button resolved my issue.