how to distingush multiple ajax submit in single ajax callback I trying to do add more functionality for adding video urls which I am able to do by using Ajax callback.I am referring a drupal examples for it.It has one remove one button which removes last created text field from form. But I want a remove button for each text-field to remove it. 

I am creating textfields and remove button in form hook like

for ($i=0; $i &lt; $form_state['num_names']; $i++) {
        $form['names_fieldset'][$i]['title'][$i] = array(
            '#type' =&gt; 'textfield',
            '#title' =&gt; t('Video Title'),
            '#default_value' =&gt; $webinar_videos[$i]-&gt;title,
        );
        $form['names_fieldset'][$i]['url'][$i] = array(
            '#type' =&gt; 'textfield',
            '#title' =&gt; t('Video Url'),
            '#default_value' =&gt; $webinar_videos[$i]-&gt;video_url,
        );
        $form['names_fieldset'][$i]['remove'][$i] = array(
            '#type' =&gt; 'submit',
            '#value' =&gt; t('Remove'),
            '#submit' =&gt; array('webinar_add_more_remove_one'),
            '#validate' =&gt;false,
            '#ajax' =&gt; array(
                'callback' =&gt; 'webinar_add_more_callback',
                'wrapper' =&gt; 'names-fieldset-wrapper',
            ),
        );
}


Now a 'webinar_add_more_remove_one' submit callback is like 

function webinar_add_more_remove_one($form, &amp;$form_state) {

    if ($form_state['num_names'] &gt; 1) {
        $form_state['num_names']--;
    }
    $form_state['rebuild'] = TRUE;
}


and 'webinar_add_more_callback' this callback returns a wrapper element like

function webinar_add_more_callback($form, $form_state) {
    return $form['names_fieldset'];
}


My question is How I can pass a video id to particular remove submit button so that I can delete particular video in 'webinar_add_more_remove_one' callback?

Thank you in advance

Any help appreciated.
Last time I had to do this I used this method:

When creating the form create an array to hold deleted ids:

$form_state['deleted_items'] = array();


And give each remove button an ID relating to that items index:

$form['names_fieldset'][$i]['remove'][$i] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Remove'),
    '#submit' =&gt; array('webinar_add_more_remove_one'),
    '#validate' =&gt;false,
    '#ajax' =&gt; array(
        'callback' =&gt; 'webinar_add_more_callback',
        'wrapper' =&gt; 'names-fieldset-wrapper',
    ),
    '#attributes' =&gt; array(
        'id' =&gt; 'item-'.$i,
    ),
);


Then in webinar_add_more_remove_one check the id of the button that was pressed:

function webinar_add_more_remove_one($form, &amp;$form_state) {
    $form_state['deleted_items'][] = str_replace('item-', '', $form_state['clicked_button']['#attributes']['id']);
    $form_state['rebuild'] = TRUE;
}


And then when building the form check the array of deleted items:

for ($i=0; $i &lt; $form_state['num_names']; $i++) {

    if(in_array($i, $form_state['deleted_items']) continue;

    // rest of code....
}


You will also need to check the deleted item array in the submit and validate functions as we don't actually removed the deleted item from the $form_state array.