So, you have a field (collection, it's the same there) defined with unlimited values, and thus have an "add more" button and a row per distinct value. Let's call the field termine.

Now you have to theme the "remove" button in each row, e.g. to change the text to an imagebutton, and you wonder why your usual $form['field_termine']['und'][$k]['remove_button']['#value']="Kill"; in xxx_form_alter does not stick when adding another row via AJAX.

1 Answer 1


The solution is easy, but it took me a couple of hours wading through Drupal Core nevertheless:

foreach($form['field_termine']['und'] as $k=>$v) {
  if(!is_numeric($k)) //we only want the individual items...

Note that you will get in trouble with multi-language support with this, YMMV.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.