Is there a way to set the number of visible field collection items for an unlimited value field collection on the node add form.
The code below will add a partial item, but it does not display everything compared to clicking add item.
$form['field_ranges']['und'][1]['field_range_type']['und']['#default_value'] = 'Foo';
Thanks,
TJ
Comments
Comment #1
tjferre commentedAny ideas?
Comment #2
damienroussat commented+1
I have the same feature need. I have unlimited field collection on a node. At creation, only the first element is displayed, blank. After creation, if I try to edit it, then the first filled element is displayed as well as a second blank element. I'd like that element to be displayed only when user click on "add another element" and not by default.
Was that similar to what you were asking ?
Comment #2.0
damienroussat commentedFixed Typo
Comment #3
chi commentedI've just introduced this feature to Multiple Value Widget module (2.x branch). It should work with Field Collection as well. Please, have a look and provide some feedback.
Comment #4
jmuzz commented@damienroussat that's not what the issue summary is about but for what it's worth that feature is in field collection now. There are checkboxes in the settings forms about hiding the blank items.
@tjferre this is how multivalue fields usually work in Drupal. Field collection relies on Drupal's field system and changing how it works like that is outside its scope. I'd recommend looking for a solution in another custom module. The one @Chi recommends may work.