I am currently working on a project where i have a content type that has 2 field collections. (with cardinality 1) Each field collection has one other field collection (with unlimited cardinality).

To summarize:

Content type X

  • Field collection 1
    • Some fields
    • Field collection A (unlimited cardinality)
  • Field collection 2
    • Some fields
    • Field collection B (unlimited cardinality)


I want field collection A and B to respond to each others "add item" and "remove" actions. So that when you add an item to field collection A, automatically an item to field collection B is added as well and vice versa.

Are there any hooks available for this?

I have been doing some research but there is very little documentation about this that i can find.

Thanks so much in advance!

  • Try to reuse the field collection item machine name for two field collections.
    – Muthupriya
    Jun 17 '15 at 12:56
  • Machine names have to be unique, so you can never reuse a fields machine name
    – Guardian
    Jun 17 '15 at 13:34

I managed to solve this with some jQuery.

Not sure if this is the "cleanest" way to do this, but it works. I hook into the mousedown() event of the "add another item" button,and trigger the other button's mousedown manually.

I also added a delay of 800ms, because of some conflicting events if the 2 mousedowns are too quickly after eachother.

Hope this helps anyone in the future.

$('#edit-field-pressure-calculation-und-0-field-pressure-calculation-line .clearfix .field-add-more-submit').mousedown(function() {
    setTimeout(function() {
      $('#edit-field-heat-calculation-und-0-field-heating-calculation-line .clearfix .field-add-more-submit').mousedown();
    }, 800)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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