Question

I am trying to create a user profile field in drupal 7 that combines multiple fields and can have multiple values.
For Example, the field is "Past Job Title" ,"From Year", "To Year" and the whole field ( having 3 sub fields ) can have multiple values thus can have values like

< "Google" , 2000, 2003 ><br/>
< "Facebook" , 2003, 2007 ><br/>
< "Xerox", 2007, 2009 ><br/>

The user should be able to add as many values he/she wants. In Drupal 7, Multiple Values for a single field can be enabled by setting Number of Values to Unlimited, but how to do in case of multiple fields combined together. Please Do Suggest...

Was it helpful?

Solution

I believe what you are looking for is the Field Collection module. It allows you to group fields together and allows the entering of many groups. The following article gives a good description of what the module does: Create Multigroups in Drupal 7 using Field Collections

From the Field Collection project page:

Provides a field-collection field, to which any number of fields can be attached.

A field collection is internally represented as an entity, which is embedded in the host entity. Thus, if desired field collections may be viewed and edited separately too.

OTHER TIPS

How can we validate each field collection entity?
Let me Explain:
I have used field collection in line item types.

Line Item type = People

Field collection fields are:

Title
First Name

Last Name etc
I have given the number of values: unlimited. That's why add another item button is appearing.
Now, if user entered values in one set and left others blank and then clicked on add to cart button then, how can stop him to continue further.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top