I'm using a CTools modal to add a holiday. The topside of that form in the modal displays the already defined holidays with an "X" that will allow you to delete a holiday. I have created a submit button for each that is put in a table with this code (the rows are rendered in a table afterwards).
foreach ($locationVO->Holidays as $holiday) {
$fid = 'delete' . $holiday['id'];
$form['holidays'][$fid] =
array(
'#name' => 'delete_' . $holiday['id'],
'#type' => 'image_button',
'#src' => $crossimg,
'#attributes' => array('class' => array('delete_holiday')),
'#return_value' => $holiday['id']
);
$field = drupal_render($form['holidays'][$fid]);
$rows[] = array($holiday['name'], ISOdate2DutchDate($holiday['from']), ISOdate2DutchDate($holiday['to']), $field);
}
Everything is rendered ok, but if I try to delete a holiday, the triggering_element and the clicked_button arrays in form_state still always refer to the main submit that I defined in the CTools form_info array. I therefor cannot distinguish between the submits for adding and deleting.
What do I need to do to get my triggering_element to correspond with the selected submit? I also tried specifying a separate '#submit' handler for the delete buttons, but that is never called either.
Other solutions are welcome as well, as long a I can do it without closing/leaving the modal (I already tried with a link to a separate delete handler which worked up until the referral back to the modal).
Thanks!