Posted by deepchandra84 on February 24, 2012 at 5:40am
HI,
I have a field collection with Cardinality set to unlimited. I want to display 'Add Another item' button after Five fields by default instead of one.
So is there any way (module or hook) to set min cardinality to 5 and max cardinality to unlimited.
Regards,
Deep Chandra Upadhyay
Comments
yes u can ..........i was
yes u can ..........i was also wondering for the same but may be not the right way to do
set the max limit of the filed using variable_set();
implement hook_field_widget_form_alter and add one hidden field as delta
and on every click check the delta value for the max limit and make the add another item as display:none;
another solution is that on every add another item form is getting rebuilt and hence u can get the form array in hook_form_alter there also you will get the value of delta and can respond accordingly
Need Drupal help?
Reach Me